public virtual async Task <ActionResult> Change(string tabId, int parentId, int?userId, int?groupId, IFormCollection collection) { var permission = ChangeService.ReadOrDefaultForChange(parentId, userId, groupId); var model = PermissionViewModel.Create(permission, tabId, parentId, Service, ChangeService.ViewModelSettings); await TryUpdateModelAsync(model); if (ModelState.IsValid) { model.Data = ChangeService.Change(model.Data); return(Redirect("Change", new { tabId, parentId, userId = model.Data.UserId, groupId = model.Data.GroupId, isPostBack = true, successfulActionCode = ActionCode.ChangeEntityTypePermission })); } model.IsPostBack = true; return(await JsonHtml("ActionPermissionChange", model)); }
public virtual async Task <ActionResult> Change(string tabId, int parentId, int?userId, int?groupId, bool?isPostBack) { var permission = ChangeService.ReadOrDefault(parentId, userId, groupId); var model = PermissionViewModel.Create(permission, tabId, parentId, Service, ChangeService.ViewModelSettings, isPostBack); return(await JsonHtml("ActionPermissionChange", model)); }
public virtual ActionResult New(string tabId, int parentId) { var permission = Service.New(parentId); var model = PermissionViewModel.Create(permission, tabId, parentId, Service); return(JsonHtml("EntityPermissionProperties", model)); }
public virtual ActionResult Properties(string tabId, int parentId, int id, string successfulActionCode) { var permission = Service.Read(id); var model = PermissionViewModel.Create(permission, tabId, parentId, Service); model.SuccesfulActionCode = successfulActionCode; return(JsonHtml("EntityPermissionProperties", model)); }
public virtual ActionResult Properties(string tabId, int parentId, int id, FormCollection collection) { var permission = Service.ReadForUpdate(id); var model = PermissionViewModel.Create(permission, tabId, parentId, Service); TryUpdateModel(model); model.Validate(ModelState); if (ModelState.IsValid) { try { model.Data = Service.Update(model.Data); return(Redirect("Properties", new { tabId, parentId, id = model.Data.Id, successfulActionCode = ActionCode.UpdateSitePermission })); } catch (ActionNotAllowedException nae) { ModelState.AddModelError("OperationIsNotAllowedForAggregated", nae.Message); return(JsonHtml("EntityPermissionProperties", model)); } } return(JsonHtml("EntityPermissionProperties", model)); }
public virtual async Task <ActionResult> New(string tabId, int parentId, IFormCollection collection) { var permission = Service.New(parentId); var model = PermissionViewModel.Create(permission, tabId, parentId, Service); await TryUpdateModelAsync(model); if (ModelState.IsValid) { try { model.Data = Service.Save(model.Data); PersistResultId(model.Data.Id); return(Redirect("Properties", new { tabId, parentId, id = model.Data.Id, successfulActionCode = ActionCode.SaveSitePermission })); } catch (ActionNotAllowedException nae) { ModelState.AddModelError("OperationIsNotAllowedForAggregated", nae.Message); return(await JsonHtml("EntityPermissionProperties", model)); } } return(await JsonHtml("EntityPermissionProperties", model)); }