public void UpdateCustomer(Models.Customer model) { using (LoyaltyPointSystemEntities db = new LoyaltyPointSystemEntities()) { var cus = db.Customers.ToList().FirstOrDefault(x => x.ID == model.ID); cus.ID = model.ID; cus.Loyalty_Points = model.Loyalty_Points; db.SaveChanges(); } }
public void CreateRole(Models.EmployeeRole model) { using (LoyaltyPointSystemEntities db = new LoyaltyPointSystemEntities()) { Models.EmployeeRole role = new Models.EmployeeRole(); role.RoleName = model.RoleName; db.EmployeeRoles.Add(role); db.SaveChanges(); } }
public void CreateCustomer(Models.Customer model) { using (LoyaltyPointSystemEntities db = new LoyaltyPointSystemEntities()) { Models.Customer cus = new Models.Customer(); cus.Cell_No = model.Cell_No; cus.DateCreated = model.DateCreated; cus.Email = model.Email; cus.GenderID = model.GenderID; cus.ID_No = model.ID_No; cus.Loyalty_Points = model.Loyalty_Points; cus.Name = model.Name; cus.Surname = model.Surname; db.Customers.Add(cus); db.SaveChanges(); } }
public void CreateEmployee(Models.Employee model) { using (LoyaltyPointSystemEntities db = new LoyaltyPointSystemEntities()) { Models.Employee emp = new Models.Employee(); emp.Employee_No = model.Employee_No; emp.GenderID = model.GenderID; emp.ID_No = model.ID_No; emp.Name = model.Name; emp.Surname = model.Surname; emp.Password = model.Password; emp.RoleID = model.RoleID; emp.Username = model.Username; emp.Email = model.Email; emp.CellPhone = model.CellPhone; emp.ClubName = model.ClubName; emp.IsDeleted = false; db.Employees.Add(emp); db.SaveChanges(); } }