Example #1
0
        public GetWavesResponse GetWavesForGrid(GetWavesRequest 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 GetWavesResponse
            {
                TotalRecords = totalRecords,
                Waves = data.ToList().MapTo<GetWavesResponse.WaveResponse>()
            };
        }
Example #2
0
 public GetWavesResponse GetWaves(GetWavesRequest request)
 {
     var query = DataContext.Waves.AsQueryable();
     if (request.OnlyCount)
     {
         return new GetWavesResponse { Count = query.Count() };
     }
     else
     {
         query = query.Include(x => x.Value);
         query = query.OrderByDescending(x => x.Id).Skip(request.Skip).Take(request.Take);
         return new GetWavesResponse
         {
             Waves = query.MapTo<GetWavesResponse.WaveResponse>()
         };
     }
 }