示例#1
0
 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));
 }
示例#2
0
 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));
 }
示例#3
0
 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));
 }