Exemplo n.º 1
0
 public GetWeathersResponse GetWeathers(GetWeathersRequest request)
 {
     var query = DataContext.Weathers.AsQueryable();
     if (request.OnlyCount)
     {
         return new GetWeathersResponse { Count = query.Count() };
     }
     else
     {
         query = query.Include(x => x.Value);
         query = query.OrderByDescending(x => x.Id).Skip(request.Skip).Take(request.Take);
         return new GetWeathersResponse
         {
             Weathers = query.MapTo<GetWeathersResponse.WeatherResponse>()
         };
     }
 }
Exemplo n.º 2
0
        public GetWeathersResponse GetWeathersForGrid(GetWeathersRequest 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 GetWeathersResponse
            {
                TotalRecords = totalRecords,
                Weathers = data.ToList().MapTo<GetWeathersResponse.WeatherResponse>()
            };
        }