public async Task <IActionResult> Edit([Bind("Examsl,Studentid,Examname,Institution,Board,Result")] Examresult examresult) { if (ModelState.IsValid) { try { _context.Update(examresult); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ExamresultExists(examresult.Examsl, examresult.Studentid)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Studentid"] = new SelectList(_context.Student, "Id", "Id", examresult.Studentid); return(View(examresult)); }
public async Task <IActionResult> Create([Bind("Examsl,Studentid,Examname,Institution,Board,Result")] Examresult examresult) { try { if (ModelState.IsValid) { _context.Add(examresult); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["Studentid"] = new SelectList(_context.Student, "Id", "Id", examresult.Studentid); return(View(examresult)); } catch (DbUpdateException dbx) { ViewData["err"] = "Inserted Exam Serial No. is already exists"; return(View()); } catch (Exception ex) { ViewData["err"] = ex.Message.ToString(); return(View()); } }
public ActionResult DeleteConfirmed(int id) { Examresult examresult = db.Examresults.Find(id); db.Examresults.Remove(examresult); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(Examresult examresult) { if (ModelState.IsValid) { db.Entry(examresult).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.StudentID = new SelectList(db.Students, "StudentID", "StudentName", examresult.StudentID); return(View(examresult)); }
public ActionResult Create(Examresult examresult) { if (ModelState.IsValid) { db.Examresults.Add(examresult); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.StudentID = new SelectList(db.Students, "StudentID", "StudentName", examresult.StudentID); return(View(examresult)); }
// GET: Examresult/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Examresult examresult = db.Examresults.Find(id); if (examresult == null) { return(HttpNotFound()); } return(View(examresult)); }
// GET: Examresult/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Examresult examresult = db.Examresults.Find(id); if (examresult == null) { return(HttpNotFound()); } ViewBag.StudentID = new SelectList(db.Students, "StudentID", "StudentName", examresult.StudentID); return(View(examresult)); }