コード例 #1
0
        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"));
            }
        }
コード例 #2
0
        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());
            }
        }
コード例 #3
0
        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());
        }