public async Task <IActionResult> PutProduct(string id, Product product) { if (id != product.ProductId) { return(BadRequest()); } _context.Entry(product).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutCategory(string id, Category category) { if (id != category.CategoryId) { return(BadRequest()); } _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> PutBrand(string id, Brand brand) { if (id != brand.BrandId) { return(BadRequest()); } _context.Entry(brand).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BrandExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }