public async Task <IActionResult> PutBrand([FromRoute] int id, [FromBody] Brand brand) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != brand.id) { return(BadRequest()); } _context.Entry(brand).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BrandExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutProduct_Unit([FromRoute] int id, [FromBody] Product_Unit product_Unit) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != product_Unit.unitId) { return(BadRequest()); } _context.Entry(product_Unit).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Product_UnitExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }