public ActionResult Configure(string id = null) { var vm = new DelegationSettingsForUserViewModel(this.delegationRepository, this.userManagementRepository, id); return View("Configure", vm); }
public ActionResult Add(DelegationSetting model) { if (ModelState.IsValid) { try { this.delegationRepository.Add(model); TempData["Message"] = "Realm Added"; return RedirectToAction("Configure", new { id = model.UserName }); } catch (ValidationException ex) { ModelState.AddModelError("", ex.Message); } catch { ModelState.AddModelError("", "Error adding delegation setting."); } } var vm = new DelegationSettingsForUserViewModel(this.delegationRepository, this.userManagementRepository, model.UserName); return View("Configure", vm); }
public ActionResult Remove(DelegationSetting model) { try { this.delegationRepository.Delete(model); TempData["Message"] = Resources.DelegationController.RealmDeleted; return RedirectToAction("Configure", new { id = model.UserName }); } catch (ValidationException ex) { ModelState.AddModelError("", ex.Message); } catch { ModelState.AddModelError("", Resources.DelegationController.ErrorDeletingDelegationSetting); } var vm = new DelegationSettingsForUserViewModel(this.delegationRepository, this.userManagementRepository, model.UserName); return View("Configure", vm); }