public async Task <IActionResult> Edit(string id, [Bind("SnDCode,SnDName,SortingNo,CircleCode")] LookUpSnDInfo lookUpSnDInfo) { if (id != lookUpSnDInfo.SnDCode) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(lookUpSnDInfo); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LookUpSnDInfoExists(lookUpSnDInfo.SnDCode)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CircleCode"] = new SelectList(_context.LookUpCircleInfo, "CircleCode", "CircleName", lookUpSnDInfo.CircleCode); return(View(lookUpSnDInfo)); }
public async Task <IActionResult> Create([Bind("SnDCode,SnDName,SortingNo,CircleCode")] LookUpSnDInfo lookUpSnDInfo) { if (ModelState.IsValid) { _context.Add(lookUpSnDInfo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CircleCode"] = new SelectList(_context.LookUpCircleInfo, "CircleCode", "CircleName", lookUpSnDInfo.CircleCode); return(View(lookUpSnDInfo)); }