Exemplo n.º 1
0
        //******************Retrieve Student Details**********************
        // GET: Student
        public ActionResult Index()
        {
            StudentHandle dbhandle = new StudentHandle();

            ModelState.Clear();
            return(View(dbhandle.GetStudent()));
        }
Exemplo n.º 2
0
 public ActionResult Edit(int id, StudentModel smodel)
 {
     try
     {
         StudentHandle sdb = new StudentHandle();
         sdb.UpdateDetails(smodel);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Exemplo n.º 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());
     }
 }
Exemplo n.º 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());
            }
        }
Exemplo n.º 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)));
        }