public ActionResult Editstudent(int id) { Student_Test objj = obj.Student_Test.Where(x => x.student_id == id).FirstOrDefault(); if (objj != null) { return(View(objj)); } else { return(View("Error")); } }
public ActionResult Editstudent(Student_Test t) { int row = obj.sp_updatestudent(t.student_id, t.name, t.address, t.@class); if (row > 0) { return(RedirectToAction("viewstudent")); } else { return(View()); } }
public ActionResult AddStudent(Student_Test t) { if (ModelState.IsValid) { ObjectParameter op = new ObjectParameter("id", 0); int r = obj.sp_student_test(t.name, t.address, t.@class, op); if (r > 0) { Response.Write("<script>alert('student added succesfully')</script>"); return(RedirectToAction("viewstudent")); } else { Response.Write("<script>alert('please enter valid details')</script>"); // return RedirectToAction("AddStudent"); } } return(View()); }