public async Task <IActionResult> Put([FromBody] Customer customer) { try { var dbCustomer = await customers.GetCustomerNoTracking(customer.Id); if (dbCustomer == null) { return(NotFound(new { Id = customer.Id, error = "No customer with an id of " + customer.Id + " to update." })); } await customers.UpdateCustomer(customer); return(Ok(customer)); } catch (DbUpdateException) { return(BadRequest()); } }
public async Task Edit(Customer customer) { await customers.UpdateCustomer(customer); }