Exemplo n.º 1
0
 public bool Register(ProfileModel model)
 {
     using (var db = new EntityContext())
     {
         if (!_customer.CheckExistingPhonenumber(db, model.Phonenumber, 0))
         {
             TbCustomer customer = new TbCustomer
             {
                 Name        = model.Name,
                 Status      = db.tbStatuses.FirstOrDefault(s => s.Id == 1),
                 Address     = model.Address,
                 BCEL_Baht   = model.BCEL_Baht,
                 BCEL_Dollar = model.BCEL_Dollar,
                 BCEL_Kip    = model.BCEL_Kip,
                 Phonenumber = model.Phonenumber,
                 isDeleted   = false,
                 Password    = model.Password
             };
             db.tbCustomers.Add(customer);
             db.SaveChanges();
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }