// GET: Curd public ActionResult Index() { StudentDbHandel db = new StudentDbHandel(); ModelState.Clear(); return(View(db.GetDetails())); }
public ActionResult Edit(int id, StudentList Modelcollection) { try { StudentDbHandel dbhn = new StudentDbHandel(); dbhn.UpdateDetails(Modelcollection); return(RedirectToAction("Index")); } catch { return(View()); } }
// GET: Curd/Delete/5 public ActionResult Delete(int id) { try { StudentDbHandel dbhn = new StudentDbHandel(); if (dbhn.DeleteStudent(id)) { ViewBag.AlertMsg = "Student Deleted Successfully"; } return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(StudentList Modelcollection) { try { // TODO: Add insert logic here if (ModelState.IsValid) { StudentDbHandel dbhn = new StudentDbHandel(); if (dbhn.AddStudent(Modelcollection)) { ViewBag.Message = "Student Details Added Successfully"; ModelState.Clear(); } } return(RedirectToAction("Index")); } catch { return(View()); } }
// GET: Curd/Edit/5 public ActionResult Edit(int id) { StudentDbHandel dbhn = new StudentDbHandel(); return(View(dbhn.GetDetails().Find(funding => funding.Id == id))); }