public async Task <IActionResult> Edit(short id, [Bind("MbcsId,MbcsMbmgId,MbcsCaus,MbcsDescr,MbcsMgauId")] MbCausal mbCausal) { if (id != mbCausal.MbcsId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(mbCausal); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MbCausalExists(mbCausal.MbcsId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["MbcsMbmgId"] = new SelectList(_context.MbMag, "MbmgId", "MbmgCode", mbCausal.MbcsMbmgId); ViewData["MbcsMgauId"] = new SelectList(_context.MgAnaUbicazioni, "MgauId", "MgauCodCompl", mbCausal.MbcsMgauId); return(View(mbCausal)); }
public async Task <IActionResult> Create([Bind("MbcsId,MbcsMbmgId,MbcsCaus,MbcsDescr,MbcsMgauId")] MbCausal mbCausal) { if (ModelState.IsValid) { _context.Add(mbCausal); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["MbcsMbmgId"] = new SelectList(_context.MbMag, "MbmgId", "MbmgCode", mbCausal.MbcsMbmgId); ViewData["MbcsMgauId"] = new SelectList(_context.MgAnaUbicazioni, "MgauId", "MgauCodCompl", mbCausal.MbcsMgauId); return(View(mbCausal)); }