public async Task <IActionResult> Edit(short id, [Bind("Id,CStage,SCode")] ClaSub claSub) { if (id != claSub.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(claSub); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClaSubExists(claSub.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["CStage"] = new SelectList(_context.Class, "CStage", "CStage", claSub.CStage); ViewData["SCode"] = new SelectList(_context.Subject, "SCode", "SName", claSub.SCode); return(View(claSub)); }
public async Task <IActionResult> Create([Bind("Id,CStage,SCode")] ClaSub claSub) { if (ModelState.IsValid) { _context.Add(claSub); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewData["CStage"] = new SelectList(_context.Class, "CStage", "CStage", claSub.CStage); ViewData["SCode"] = new SelectList(_context.Subject, "SCode", "SName", claSub.SCode); return(View(claSub)); }