public Customer UpdateCustomer(Customer customer) { if (_context.Customers.Local.All(c => c.Id != customer.Id)) { _context.Customers.Attach(customer); } //_context.Entry(customer).State = EntityState.Modified; _context.SaveChanges(); return customer; }
public Customer AddCustomer(Customer customer) { _context.Customers.Add(customer); _context.SaveChanges(); return customer; }