public async Task <IActionResult> PutCustomer(long id, Models.Customer customer) { if (id != customer.Id) { return(BadRequest()); } _context.Entry(customer).State = Microsoft.EntityFrameworkCore.EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException) { if (!CustomerExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> UpdateCustomerAsync(long id, [FromBody] Customer customer) { if (id != customer.Id) { return(BadRequest()); } _context.Entry(customer).State = EntityState.Modified; await _context.SaveChangesAsync(); return(NoContent()); }