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)); }
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)); }
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")); }