public async Task <IActionResult> Edit(int id, [Bind("Id,StockName")] Stock stock) { if (id != stock.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(stock); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StockExists(stock.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(stock)); }
public async Task <IActionResult> Edit(int id, [Bind("EmployeeId,Name")] Employee employee) { if (id != employee.EmployeeId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(employee); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployeeExists(employee.EmployeeId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(employee)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,DateRecieved,StockId,WarehouseId,EmployeeId")] Inventory inventory) { if (id != inventory.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(inventory); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InventoryExists(inventory.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["EmployeeId"] = new SelectList(_context.Employees, "EmployeeId", "EmployeeId", inventory.EmployeeId); ViewData["StockId"] = new SelectList(_context.Stocks, "Id", "Id", inventory.StockId); ViewData["WarehouseId"] = new SelectList(_context.Warehouses, "Id", "Id", inventory.WarehouseId); return(View(inventory)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Location")] Warehouse warehouse) { if (id != warehouse.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(warehouse); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WarehouseExists(warehouse.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(warehouse)); }