public GridJsonNetJObjectResult <Organization> IndexGridJsonData() { var hasDeleteOrganizationPermission = new OrganizationManageFeature().HasPermissionByPerson(CurrentPerson); var gridSpec = new IndexGridSpec(CurrentPerson, hasDeleteOrganizationPermission); var organizations = HttpRequestStorage.DatabaseEntities.Organizations.ToList().OrderBy(x => x.DisplayName).ToList(); var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <Organization>(organizations, gridSpec); return(gridJsonNetJObjectResult); }
public IndexViewData(Person currentPerson, Models.FirmaPage firmaPage) : base(currentPerson, firmaPage) { PageTitle = $"{Models.FieldDefinition.Organization.GetFieldDefinitionLabelPluralized()}"; var hasOrganizationManagePermissions = new OrganizationManageFeature().HasPermissionByPerson(currentPerson); GridSpec = new IndexGridSpec(currentPerson, hasOrganizationManagePermissions) { ObjectNameSingular = $"{Models.FieldDefinition.Organization.GetFieldDefinitionLabel()}", ObjectNamePlural = $"{Models.FieldDefinition.Organization.GetFieldDefinitionLabelPluralized()}", SaveFiltersInCookie = true }; if (hasOrganizationManagePermissions) { var contentUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(t => t.New()); GridSpec.CreateEntityModalDialogForm = new ModalDialogForm(contentUrl, $"Create a new {Models.FieldDefinition.Organization.GetFieldDefinitionLabel()}"); } GridName = "organizationsGrid"; GridDataUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(tc => tc.IndexGridJsonData()); }