예제 #1
0
파일: SelectService.cs 프로젝트: fazar/Pear
        public GetSelectsResponse GetSelectsForGrid(GetSelectsRequest request)
        {
            int totalRecords;
            var data = SortData(request.Search, request.SortingDictionary, out totalRecords);
            if (request.Take != -1)
            {
                data = data.Skip(request.Skip).Take(request.Take);
            }

            return new GetSelectsResponse
            {
                TotalRecords = totalRecords,
                Selects = data.ToList().MapTo<GetSelectsResponse.Select>()
            };
        }
예제 #2
0
파일: SelectService.cs 프로젝트: fazar/Pear
 public GetSelectsResponse GetSelects(GetSelectsRequest request)
 {
     List<Select> selects;
     if (request.Take != 0)
     {
         selects = DataContext.Selects
             .Include(x => x.Options)
             .OrderBy(x => x.Id).Skip(request.Skip).Take(request.Take).ToList();
     }
     else
     {
         selects = DataContext.Selects
             .Include(x => x.Options)
             .OrderByDescending(x => x.Id).ToList();
     }
     var response = new GetSelectsResponse();
     response.Selects = selects.MapTo<GetSelectsResponse.Select>();
     return response;
 }