public Task <SearchResult <UMAPendingRequest> > FindByResource(string resourceId, SearchRequestParameter parameter, CancellationToken cancellationToken) { var filteredUMAPendingRequests = LstData.AsQueryable(); filteredUMAPendingRequests = filteredUMAPendingRequests.Where(f => f.Resource.Id == resourceId); return(InternalFind(filteredUMAPendingRequests, parameter)); }
public Task <SearchResult <UMAPendingRequest> > FindByOwner(string owner, SearchRequestParameter parameter, CancellationToken cancellationToken) { var filteredUMAPendingRequests = LstData.AsQueryable(); filteredUMAPendingRequests = filteredUMAPendingRequests.Where(f => f.Owner == owner); return(InternalFind(filteredUMAPendingRequests, parameter)); }
public Task <SearchResult <UMAResource> > Find(SearchUMAResourceParameter searchRequestParameter, CancellationToken token) { var filteredUmaResources = LstData.AsQueryable(); if (!string.IsNullOrWhiteSpace(searchRequestParameter.Subject)) { filteredUmaResources = filteredUmaResources.Where(f => f.Subject == searchRequestParameter.Subject); } int totalResults = LstData.Count(); if (searchRequestParameter.SortKey == "CreateDateTime") { switch (searchRequestParameter.SortOrder) { case SearchRequestOrders.ASC: filteredUmaResources = filteredUmaResources.OrderBy(p => p.CreateDateTime); break; case SearchRequestOrders.DESC: filteredUmaResources = filteredUmaResources.OrderByDescending(p => p.CreateDateTime); break; } } filteredUmaResources = filteredUmaResources.Skip(searchRequestParameter.StartIndex).Take(searchRequestParameter.Count); return(Task.FromResult(new SearchResult <UMAResource> { Records = filteredUmaResources.ToList(), TotalResults = totalResults })); }
public Task <SearchResult <OAuthScope> > Find(SearchScopeParameter parameter, CancellationToken cancellationToken) { var result = LstData.AsQueryable(); if (MAPPING_SCOPE_TO_PROPERTYNAME.ContainsKey(parameter.OrderBy)) { result = result.InvokeOrderBy(MAPPING_SCOPE_TO_PROPERTYNAME[parameter.OrderBy], parameter.Order); } int totalLength = result.Count(); result = result.Skip(parameter.StartIndex).Take(parameter.Count); return(Task.FromResult(new SearchResult <OAuthScope> { StartIndex = parameter.StartIndex, Count = parameter.Count, TotalLength = totalLength, Content = result.ToList() })); }
public Task <SearchResult <UMAPendingRequest> > Find(SearchRequestParameter parameter, CancellationToken cancellationToken) { var filteredUMAPendingRequests = LstData.AsQueryable(); return(InternalFind(filteredUMAPendingRequests, parameter)); }