public async Task <IActionResult> Create([Bind("Id,Name,Description,Category,Quantity")] InventoryItem inventoryItem) { if (ModelState.IsValid) { inventoryItem.Updated = DateTime.Now; _context.Add(inventoryItem); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(inventoryItem)); }
public void PlacePallet(PlacePalletRequest pallet) { if (pallet == null || pallet.Size == null) { throw new Exception("PlacePalletRequest is null"); } var palletModel = new Pallet { IsPlaced = true, Size = new Size { Heigh = pallet.Size.Height, Length = pallet.Size.Length, Width = pallet.Size.Width }, Weight = pallet.Weight }; _inventorManagerContext.Add(palletModel); _inventorManagerContext.SaveChanges(); }