public async Task <IActionResult> PutMovie(int id, Movie movie) { if (id != movie.Id) { return(BadRequest()); } _context.Entry(movie).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!_context.Movies.Any(m => m.Id == id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutCustomer(int id, Customer customer) { if (id != customer.Id) { return(BadRequest()); } _context.Entry(customer).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!_context.Customers.Any(c => c.Id == id)) { return(NotFound()); } else { throw; } } return(NoContent()); }