Ejemplo n.º 1
0
 public ActionResult Create(StudentRegForm studentRegForm)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.StudentRegForm.Add(studentRegForm);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         return(View(studentRegForm));
     }
     return(View(studentRegForm));
 }
Ejemplo n.º 2
0
 public ActionResult Edit(StudentRegForm studentRegForm)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Entry(studentRegForm).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         return(Redirect("~/ErrorHandler.html"));
     }
     return(View(studentRegForm));
 }
Ejemplo n.º 3
0
 public ActionResult EditStudentType(int Id)
 {
     try
     {
         if (Id != 0)
         {
             var edtstutyp  = db.StudentRegForm.Where(x => x.StudentRegFormId == Id).FirstOrDefault();
             var edtstutyp1 = new StudentRegForm
             {
                 StudentRegFormId = edtstutyp.StudentRegFormId,
                 Name             = edtstutyp.Name
             };
             return(PartialView("~/Views/Shared/PartialViewsForms/_EditStudentType.cshtml", edtstutyp1));
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         return(Redirect("~/ErrorHandler.html"));
     }
     return(PartialView("~/Views/Shared/PartialViewsForms/_EditStudentType.cshtml"));
 }