Ejemplo n.º 1
0
        // GET: Curd
        public ActionResult Index()
        {
            StudentDbHandel db = new StudentDbHandel();

            ModelState.Clear();

            return(View(db.GetDetails()));
        }
Ejemplo n.º 2
0
 public ActionResult Edit(int id, StudentList Modelcollection)
 {
     try
     {
         StudentDbHandel dbhn = new StudentDbHandel();
         dbhn.UpdateDetails(Modelcollection);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Ejemplo n.º 3
0
 // 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());
     }
 }
Ejemplo n.º 4
0
        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());
            }
        }
Ejemplo n.º 5
0
        // GET: Curd/Edit/5
        public ActionResult Edit(int id)
        {
            StudentDbHandel dbhn = new StudentDbHandel();

            return(View(dbhn.GetDetails().Find(funding => funding.Id == id)));
        }