Exemple #1
0
 // All customer mappings
 // DataAccess to/from Library
 public static Library.Customer ManMap(DA.Customer customer) => new Library.Customer
 {
     CustomerID       = customer.CustomerId,
     FirstName        = customer.FirstName,
     LastName         = customer.LastName,
     DefaultAddressId = customer.DefaultAddressId,
     CustomerPassword = customer.CustomerPassword
 };
        public Customer SearchCustomerByNameandPassword(string firstname, string lastname, string password)
        {
            // this miplementation does will break if there is no customer in databse wit the given specs.
            // only use this after you have verified with VerifyCustomer()
            DA.Customer customer  = _db.Customer.Where(c => c.FirstName.ToLower() == firstname && c.LastName.ToLower() == lastname && c.CustomerPassword == password).FirstOrDefault();
            Customer    customer1 = ManualMapper.ManMap(customer);

            return(customer1);
        }
 public bool VerifyCustomer(string firstname, string lastname, string password)
 {
     DA.Customer customer = _db.Customer.Where(c => c.FirstName.ToLower() == firstname && c.LastName.ToLower() == lastname && c.CustomerPassword == password).FirstOrDefault();
     if (customer.CustomerId != null && customer.CustomerId != 0)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
 public Customer GetCustomerByID(int customerID)
 {
     DA.Customer customer = _db.Customer.Where(c => c.CustomerId == customerID).FirstOrDefault();
     return(ManualMapper.ManMap(customer));
 }