public async Task <IActionResult> PutProducts(int id, Products products) { if (id != products.ProductId) { return(BadRequest()); } _context.Entry(products).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutEmployees([FromRoute] int id, [FromBody] Employees employees) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != employees.EmployeeId) { return(BadRequest()); } _context.Entry(employees).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployeesExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }