public ActionResult Add()
 {
     MembershipRoleModel model = new MembershipRoleModel();
     model.LoadCheckBoxList();
     if (Request.IsAjaxRequest())
     {
         return PartialView("MembershipRole/_MembershipRoleAdd", model);
     }
     return View(model);
 }
 public ActionResult Add(MembershipRoleModel model)
 {
     model.LoadCheckBoxList();
     if (ModelState.IsValid)
     {
         try
         {
             membershipRoleRepository.AddObject(model);
             return RedirectToAction("Index");
         }
         catch (Exception ex)
         {
             throw new Exception("Wystąpił błąd podczas dodawania roli. Proszę o kontakt z administratorem. Error message: " + ex.Message);
         }
     }
     else
     {
         if (Request.IsAjaxRequest())
         {
             return PartialView("MembershipRole/_MembershipRoleAdd", model);
         }
         return View(model);
     }
 }
 public ActionResult Edit(MembershipRoleModel model)
 {
     membershipRoleRepository.EditObject(model);
     return RedirectToAction("Index");
 }