public async Task <BaseReponse <ModelListResult <SlideViewModel> > > GetAllPaging(SlideRequest request) { var query = (await _slideRepository.FindAll()).AsNoTracking().AsParallel(); if (!string.IsNullOrEmpty(request.SearchText)) { query = query.AsParallel().AsOrdered().WithDegreeOfParallelism(3).Where(x => x.Name.Contains(request.SearchText)); } int totalRow = query.AsParallel().AsOrdered().WithDegreeOfParallelism(3).Count(); var data = query.AsParallel().AsOrdered().WithDegreeOfParallelism(3).OrderByDescending(x => x.Id) .Skip((request.PageIndex - 1) * request.PageSize) .Take(request.PageSize); var items = new SlideViewModel().Map(data).ToList(); return(new BaseReponse <ModelListResult <SlideViewModel> > { Data = new ModelListResult <SlideViewModel>() { Items = items, Message = Message.Success, RowCount = totalRow, PageSize = request.PageSize, PageIndex = request.PageIndex }, Message = Message.Success, Status = (int)QueryStatus.Success }); }
public IActionResult GetAllPaging(SlideRequest request) { var model = _slideService.GetAllPaging(request); return(new OkObjectResult(model)); }
public async Task <IActionResult> GetAllPaging(SlideRequest request) { var model = await _slideService.GetAllPaging(request); return(new OkObjectResult(model)); }