public SearchResult <RoleGroupDTO> GetDataByFilter(RoleGroupSearchFilter filter) { if (string.IsNullOrEmpty(filter.SortName)) { filter.SortName = "RoleGroup_PK"; } RoleGroupQuery roleGroupQuery = new RoleGroupQuery(this.Db); var filteredRecords = roleGroupQuery.GetQuery() .Where(roleGroup => roleGroup.Title.Contains(filter.Keyword) || roleGroup.Description.Contains(filter.Keyword)); var displayedRecords = filteredRecords. SortBy(filter.SortName, filter.SortDir) .Skip(filter.Skip) .Take(filter.PageSize) .ToList(); var searchResult = new SearchResult <RoleGroupDTO>(filter); searchResult.Filter = filter; searchResult.Count.TotalRecords = roleGroupQuery.GetTotalRecords(); searchResult.Count.TotalFiltered = filteredRecords.Count(); searchResult.Count.TotalDisplayed = displayedRecords.Count(); searchResult.Records = displayedRecords; return(searchResult); }
public RoleGroupListModel Get(RoleGroupSearchFilter searchFilter) { RoleGroupListFormData formData = new RoleGroupListFormData(); SearchResult <RoleGroupDTO> searchResult = roleGroupSearch.GetDataByFilter(searchFilter); return(new RoleGroupListModel() { FormData = formData, SearchResult = searchResult }); }
public IHttpActionResult Search([FromUri] RoleGroupSearchFilter filter) { ThrowIfUserHasNoRole(readRole); if (filter == null) { throw new KairosException("Missing search filter parameter"); } using (var roleGroupSearch = new RoleGroupSearch(Db)) { var data = roleGroupSearch.GetDataByFilter(filter); return(Ok(new SuccessResponse(data))); } }
public IHttpActionResult Search([FromUri] RoleGroupSearchFilter filter) { string accessType = "RoleGroup_ViewAll"; ThrowIfUserCannotAccess(accessType); if (filter == null) { throw new KairosException("Missing search filter parameter"); } using (var roleGroupSearch = new RoleGroupSearch(Db)) { var data = roleGroupSearch.GetDataByFilter(filter); return(Ok(new SuccessResponse(data))); } }