Exemplo n.º 1
0
 public static Customer Map(CustomerWeb customer) => new Customer
 {
     Id                 = customer.id,
     FirstName          = customer.firstName,
     LastName           = customer.lastName,
     UserName           = customer.userName,
     Password           = customer.password,
     FavoriteLocationId = customer.favoriteLocationId
 };
Exemplo n.º 2
0
        public CustomerWeb SignIn(PizzaStoreDBContext dbContext)
        {
            string userName;
            string password;


            while (true)
            {
                do
                {
                    Console.WriteLine("Please enter your username:"******"Username cannot be empty.");
                    }
                } while (userName.Length == 0);

                do
                {
                    Console.WriteLine("Please enter your password:"******"Password cannot be empty.");
                    }
                } while (password.Length == 0);


                try
                {
                    var customer = dbContext.Customer.First(u => u.UserName == userName && u.Password == password).ToString();
                    break;
                }
                catch
                {
                    Console.WriteLine("Either your username or password is incorrect. Please try again.");
                }
            }

            Customer    customerInfo = dbContext.Customer.First(u => u.UserName == userName && u.Password == password);
            CustomerWeb customerObj  = Mapper.Map(customerInfo);

            return(customerObj);
        }
Exemplo n.º 3
0
 public CustomerWeb Login(CustomerWeb customer)
 {
     return(Mapper.Map(_db.Customer.First(u => u.UserName == customer.userName && u.Password == customer.password)));
 }
Exemplo n.º 4
0
 public void AddCustomer(CustomerWeb customer)
 {
     _db.Add(Mapper.Map(customer));
 }