public async Task <IActionResult> PutProductContainerInventory(int id, ProductContainerInventory productContainerInventory) { if (id != productContainerInventory.ContainerSizeId) { return(BadRequest()); } _context.Entry(productContainerInventory).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductContainerInventoryExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <ProductContainerInventory> > PostProductContainerInventory(ProductContainerInventory productContainerInventory) { _context.ProductContainerInventory.Add(productContainerInventory); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (ProductContainerInventoryExists(productContainerInventory.ContainerSizeId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetProductContainerInventory", new { id = productContainerInventory.ContainerSizeId }, productContainerInventory)); }