// GET: Student public ActionResult Index() { StdentDB dbhandle = new StdentDB(); ModelState.Clear(); return(View(dbhandle.GetStudent())); }
public ActionResult Edit(int id, StudentModel smodel) { try { StdentDB sdb = new StdentDB(); sdb.UpdateDetails(smodel); return(RedirectToAction("Index")); } catch { return(View()); } }
// GET: Student/Delete/5 public ActionResult Delete(int id) { try { StdentDB sdb = new StdentDB(); if (sdb.DeleteStudent(id)) { ViewBag.AlertMsg = "Student Deleted Successfully"; } return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(StudentModel smodel) { try { if (ModelState.IsValid) { StdentDB sdb = new StdentDB(); if (sdb.AddStudent(smodel)) { ViewBag.Message = "Student Details Added Successfully"; ModelState.Clear(); } } return(View()); } catch { return(View()); } }
// GET: Student/Edit/5 public ActionResult Edit(int id) { StdentDB sdb = new StdentDB(); return(View(sdb.GetStudent().Find(smodel => smodel.Id == id))); }