public async Task <IActionResult> PutCategory(long id, [Bind("Name")] Category category) { // if (id != category.Id) // { // return BadRequest(); // } category.Id = id; _context.Entry(category).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoryExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutProduct(long id, Product product) { // if (id != product.Id) // { // return BadRequest(); // } product.Id = id; _context.Entry(product).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }