Beispiel #1
0
        //******************Retrieve Student Details**********************
        // GET: Student
        public ActionResult Index()
        {
            StudentHandle dbhandle = new StudentHandle();

            ModelState.Clear();
            return(View(dbhandle.GetStudent()));
        }
Beispiel #2
0
 public ActionResult Edit(int id, StudentModel smodel)
 {
     try
     {
         StudentHandle sdb = new StudentHandle();
         sdb.UpdateDetails(smodel);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Beispiel #3
0
 //************************DELETE STUDENT DATA*****************************
 // GET: Student/Delete/5
 public ActionResult Delete(int id)
 {
     try
     {
         StudentHandle sdb = new StudentHandle();
         if (sdb.DeleteStudent(id))
         {
             ViewBag.AlertMsg = "Student Deleted Successfully";
         }
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Beispiel #4
0
        public ActionResult Create(StudentModel smodel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    StudentHandle sdb = new StudentHandle();
                    if (sdb.AddStudent(smodel))
                    {
                        ViewBag.Message = "Record Added Successfully";
                        ModelState.Clear();
                    }
                }

                return(View());
            }
            catch
            {
                return(View());
            }
        }
Beispiel #5
0
        //****************************EDIT STUDENT DETAILS********************
        // GET: Student/Edit/5
        public ActionResult Edit(int id)
        {
            StudentHandle sdb = new StudentHandle();

            return(View(sdb.GetStudent().Find(smodel => smodel.Id == id)));
        }