public async Task <IActionResult> Edit(int id, [Bind("Id,PoleId,FeederLineId,PreviousPoleId,NextPoleId")] TblPoleToMultiFeederlineInfo tblPoleToMultiFeederlineInfo) { if (id != tblPoleToMultiFeederlineInfo.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tblPoleToMultiFeederlineInfo); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TblPoleToMultiFeederlineInfoExists(tblPoleToMultiFeederlineInfo.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["FeederLineId"] = new SelectList(_context.TblFeederLine, "FeederLineId", "FeederLineId", tblPoleToMultiFeederlineInfo.FeederLineId); ViewData["NextPoleId"] = new SelectList(_context.TblPole, "PoleId", "PoleId", tblPoleToMultiFeederlineInfo.NextPoleId); ViewData["PoleId"] = new SelectList(_context.TblPole, "PoleId", "PoleId", tblPoleToMultiFeederlineInfo.PoleId); ViewData["PreviousPoleId"] = new SelectList(_context.TblPole, "PoleId", "PoleId", tblPoleToMultiFeederlineInfo.PreviousPoleId); return(View(tblPoleToMultiFeederlineInfo)); }
public async Task <IActionResult> Create([Bind("Id,PoleId,FeederLineId,PreviousPoleId,NextPoleId")] TblPoleToMultiFeederlineInfo tblPoleToMultiFeederlineInfo) { if (ModelState.IsValid) { _context.Add(tblPoleToMultiFeederlineInfo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["FeederLineId"] = new SelectList(_context.TblFeederLine, "FeederLineId", "FeederName", tblPoleToMultiFeederlineInfo.FeederLineId); ViewData["NextPoleId"] = new SelectList(_context.TblPole, "PoleId", "PoleId", tblPoleToMultiFeederlineInfo.NextPoleId); ViewData["PoleId"] = new SelectList(_context.TblPole, "PoleId", "PoleId", tblPoleToMultiFeederlineInfo.PoleId); ViewData["PreviousPoleId"] = new SelectList(_context.TblPole, "PoleId", "PoleId", tblPoleToMultiFeederlineInfo.PreviousPoleId); return(View(tblPoleToMultiFeederlineInfo)); }