public ActionResult Create(PrimarySchoolUserRole primarySchoolUserRole) { try { if (ModelState.IsValid) { db.PrimarySchoolUserRoles.Add(primarySchoolUserRole); db.SaveChanges(); return(RedirectToAction("Index")); } } catch (Exception e) { Console.WriteLine(e); return(View(primarySchoolUserRole)); } return(View(primarySchoolUserRole)); }
public ActionResult Edit(PrimarySchoolUserRole primarySchoolUserRole) { try { if (ModelState.IsValid) { db.Entry(primarySchoolUserRole).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } } catch (Exception e) { Console.WriteLine(e); return(Redirect("~/ErrorHandler.html")); } return(new HttpStatusCodeResult(204)); }
public ActionResult EditPriSchRole(int Id) { try { if (Id != 0) { var edtprischrl = db.PrimarySchoolUserRoles.Where(x => x.PrimarySchoolUserRoleID == Id).FirstOrDefault(); var edtprischrl1 = new PrimarySchoolUserRole { PrimarySchoolUserRoleID = edtprischrl.PrimarySchoolUserRoleID, RoleName = edtprischrl.RoleName }; return(PartialView("~/Views/Shared/PartialViewsForms/_EditPriSchRole.cshtml", edtprischrl1)); } } catch (Exception e) { Console.WriteLine(e); return(Redirect("~/ErrorHandler.html")); } return(new HttpStatusCodeResult(204)); }