public async Task <IActionResult> Edit(int id, [Bind("ID,InventoryItemId,DailySalesId,PaymentMethodId,Quantity")] DailySalesEntry dailySalesEntry) { if (id != dailySalesEntry.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(dailySalesEntry); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DailySalesEntryExists(dailySalesEntry.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["DailySalesId"] = new SelectList(_context.DailySalesModel, "ID", "ID", dailySalesEntry.DailySalesId); ViewData["InventoryItemId"] = new SelectList(_context.InventoryItem, "ID", "ID", dailySalesEntry.InventoryItemId); ViewData["PaymentMethodId"] = new SelectList(_context.Set <PaymentMethod>(), "ID", "ID", dailySalesEntry.PaymentMethodId); return(View(dailySalesEntry)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Date,Quantity")] AddInventoryModel addInventoryModel) { if (id != addInventoryModel.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(addInventoryModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AddInventoryModelExists(addInventoryModel.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(addInventoryModel)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Name,VendorName,VendorAddress,VendorPhone,Cost,PriceCOP,PriceUSD,ReorderQty,StockQty")] InventoryItem inventoryItem) { if (id != inventoryItem.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(inventoryItem); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InventoryItemExists(inventoryItem.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(inventoryItem)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,SalesRepId,Date")] DailySalesModel dailySalesModel) { if (id != dailySalesModel.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(dailySalesModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DailySalesModelExists(dailySalesModel.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(dailySalesModel)); }