public void UpdateCustomer(CustomerModel model) { using (var context = new CustomerDbContext()) { context.Customers.Update(model); context.SaveChanges(); } }
public void CreateCustomer(CustomerModel model) { using (var context = new CustomerDbContext()) { model.ID = Guid.NewGuid(); context.Customers.Add(model); context.SaveChanges(); } }
public CustomerModel GetCustomerByID(Guid ID) { CustomerModel customerModel; using (var context = new CustomerDbContext()) { customerModel = context.Customers.FirstOrDefault(c => c.ID == ID); } return(customerModel); }
public IEnumerable <CustomerModel> GetAllCustomers() { List <CustomerModel> customers; using (var context = new CustomerDbContext()) { customers = context.Customers.ToList(); } return(customers); }