public async Task<IActionResult> Edit(int? id, [Bind("InventoryHasItemsid,Inventoryid,Itemid,Active,Isattuned,Quantity")] InventoryHasItems inventoryHasItems) { if (id != inventoryHasItems.InventoryHasItemsid) { return NotFound(); } if (ModelState.IsValid) { try { _context.Update(inventoryHasItems); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InventoryHasItemsExists(inventoryHasItems.InventoryHasItemsid)) { return NotFound(); } else { throw; } } return RedirectToAction(nameof(Index)); } ViewData["Inventoryid"] = new SelectList(_context.Inventory, "Inventoryid", "Inventoryid", inventoryHasItems.Inventoryid); ViewData["Itemid"] = new SelectList(_context.Items, "Itemsid", "Itemsid", inventoryHasItems.Itemid); return View(inventoryHasItems); }
public async Task<IActionResult> Create([Bind("InventoryHasItemsid,Inventoryid,Itemid,Active,Isattuned,Quantity")] InventoryHasItems inventoryHasItems) { if (ModelState.IsValid) { _context.Add(inventoryHasItems); await _context.SaveChangesAsync(); return RedirectToAction(nameof(Index)); } ViewData["Inventoryid"] = new SelectList(_context.Inventory, "Inventoryid", "Inventoryid", inventoryHasItems.Inventoryid); ViewData["Itemid"] = new SelectList(_context.Items, "Itemsid", "Itemsid", inventoryHasItems.Itemid); return View(inventoryHasItems); }