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 };
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); }
public CustomerWeb Login(CustomerWeb customer) { return(Mapper.Map(_db.Customer.First(u => u.UserName == customer.userName && u.Password == customer.password))); }
public void AddCustomer(CustomerWeb customer) { _db.Add(Mapper.Map(customer)); }