public async Task <IActionResult> PutUser(int id, User user) { if (id != user.ID) { return(BadRequest()); } _context.Entry(user).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutTypeProduct(int id, TypeProduct typeProduct) { if (id != typeProduct.ID) { return(BadRequest()); } _context.Entry(typeProduct).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TypeProductExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }