public async Task <IActionResult> PutStockItemCategory([FromRoute] Guid id, [FromBody] StockItemCategory stockItemCategory) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != stockItemCategory.StockItemCategoryId) { return(BadRequest()); } _context.Entry(stockItemCategory).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StockItemCategoryExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostStockItemCategory([FromBody] StockItemCategory stockItemCategory) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.StockItemCategories.Add(stockItemCategory); await _context.SaveChangesAsync(); return(CreatedAtAction("GetStockItemCategory", new { id = stockItemCategory.StockItemCategoryId }, stockItemCategory)); }