-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomersAction.cs
44 lines (37 loc) · 1.22 KB
/
CustomersAction.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
namespace StrataTest
{
class CustomersAction
{
public bool Register(string Customer,string Address, string Email)
{
if (string.IsNullOrWhiteSpace(Customer))
return false;
if (string.IsNullOrWhiteSpace(Address))
return false;
if (string.IsNullOrWhiteSpace(Email))
return false;
CustomerModel customerModel = new CustomerModel();
return customerModel.Add(Customer, Address,Email);
}
public bool Login(string Customer, string Email)
{
// we use customer id and email to authenticate
CustomerModel customerModel = new CustomerModel();
Customer customer = customerModel.Get(Customer, Email);
if (customerModel == null)
return false;
HttpContext.Current.Session["customer"] = customer;
return true;
}
public bool Logout()
{
HttpContext.Current.Session["customer"] = null;
return true;
}
}
}