Пример #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));
 }