public async Task <IActionResult> PutCategory(int id, Category category) { category.Id = id; if (category.Id <= 0) { return(BadRequest()); } _context.Entry(category).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoryExists(id)) { return((await PostCategory(category)).Result); } throw; } return(NoContent()); }
public async Task <IActionResult> PutSupplier(Guid id, Supplier supplier) { supplier.Id = id; _context.Entry(supplier).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SupplierExists(id)) { return((await PostSupplier(supplier)).Result); } throw; } return(NoContent()); }
public async Task <IActionResult> PutProduct(Guid id, Product product) { product.Id = id; _context.Entry(product).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductExists(id)) { return((await PostProduct(product)).Result); } throw; } return(NoContent()); }