public async Task <IActionResult> Edit(int id, [Bind("MummyId,ShelfId")] FegbmummyStorage fegbmummyStorage) { if (id != fegbmummyStorage.MummyId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(fegbmummyStorage); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FegbmummyStorageExists(fegbmummyStorage.MummyId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["MummyId"] = new SelectList(_context.Mummies, "MummyId", "MummyId", fegbmummyStorage.MummyId); ViewData["ShelfId"] = new SelectList(_context.FegbstorageLocations, "ShelfId", "Shelf", fegbmummyStorage.ShelfId); return(View(fegbmummyStorage)); }
public async Task <IActionResult> Create([Bind("MummyId,ShelfId")] FegbmummyStorage fegbmummyStorage) { if (ModelState.IsValid) { _context.Add(fegbmummyStorage); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["MummyId"] = new SelectList(_context.Mummies, "MummyId", "MummyId", fegbmummyStorage.MummyId); ViewData["ShelfId"] = new SelectList(_context.FegbstorageLocations, "ShelfId", "Shelf", fegbmummyStorage.ShelfId); return(View(fegbmummyStorage)); }