public async Task <IActionResult> Edit(int id, [Bind("SCManagementID,LotId,ReceivingDate,LocationId,Attachment")] SCManagement sCManagement) { if (id != sCManagement.SCManagementID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(sCManagement); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SCManagementExists(sCManagement.SCManagementID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["LocationId"] = new SelectList(_context.Location, "LocationId", "LocationId", sCManagement.LocationId); ViewData["LotId"] = new SelectList(_context.Lot, "lotId", "lotId", sCManagement.LotId); return(View(sCManagement)); }
public async Task <IActionResult> Create([Bind("SCManagementID,LotId,ReceivingDate,LocationId,Attachment")] SCManagement sCManagement) { if (ModelState.IsValid) { _context.Add(sCManagement); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["LocationId"] = new SelectList(_context.Location, "LocationId", "LocationId", sCManagement.LocationId); ViewData["LotId"] = new SelectList(_context.Lot, "lotId", "lotId", sCManagement.LotId); return(View(sCManagement)); }