public GetTemplatesResponse GetTemplates(GetTemplatesRequest request) { if (request.OnlyCount) { return new GetTemplatesResponse { Count = DataContext.DashboardTemplates.Count() }; } else { return new GetTemplatesResponse { Artifacts = DataContext.DashboardTemplates.OrderBy(x => x.Id).Skip(request.Skip).Take(request.Take) .ToList().MapTo<GetTemplatesResponse.TemplateResponse>() }; } }
public GetTemplatesResponse GetTemplates(GetTemplatesRequest request) { int totalRecords; var query = SortData(request.Search, request.SortingDictionary, out totalRecords); if(request.Take != - 1){ query = query.Skip(request.Skip).Take(request.Take); } var templates = query.ToList(); var response = new GetTemplatesResponse(); response.Artifacts = templates.MapTo<GetTemplatesResponse.TemplateResponse>(); response.TotalRecords = totalRecords; return response; /*if (request.OnlyCount) { return new GetTemplatesResponse { Count = DataContext.DashboardTemplates.Count() }; } else { return new GetTemplatesResponse { Artifacts = DataContext.DashboardTemplates.OrderBy(x => x.Id).Skip(request.Skip).Take(request.Take) .ToList().MapTo<GetTemplatesResponse.TemplateResponse>() }; }*/ }