public void Remove(Domain.Models.Customer t) { PizzaBox.Storing.Entities.Customer customer = context.Customers.ToList().Find(customer => customer.Name.Equals(t.Name)); if (customer is not null) { context.Customers.Remove(customer); context.SaveChanges(); } }
public void Update(Domain.Models.Customer existing, Domain.Models.Customer updated) { PizzaBox.Storing.Entities.Customer customer = context.Customers.ToList().Find(customer => customer.Name.Equals(existing.Name)); if (customer is not null) { customer.Name = updated.Name; context.SaveChanges(); } }
public void Remove(int id) { PizzaBox.Storing.Entities.Customer customer = context.Customers.FirstOrDefault(customer => customer.ID == id); if (customer is not null) { context.Customers.Remove(customer); context.SaveChanges(); //context.ChangeTracker.Clear(); } }