Exemple #1
0
 public GetMeasurementsResponse GetMeasurements(GetMeasurementsRequest request)
 {
     var measurements = new List<Measurement>();
     if (request.Take != 0)
     {
         measurements = DataContext.Measurements.OrderBy(x => x.Id).Skip(request.Skip).Take(request.Take).ToList();
     }
     else
     {
         measurements = DataContext.Measurements.OrderBy(x => x.Id).ToList();
     }
     var response = new GetMeasurementsResponse();
     response.Measurements = measurements.MapTo<GetMeasurementsResponse.Measurement>();
     return response;
 }
Exemple #2
0
        public GetMeasurementsResponse GetMeasurements(GetMeasurementsRequest 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 GetMeasurementsResponse
               {
               TotalRecords = totalRecords,
               Measurements = data.ToList().MapTo<GetMeasurementsResponse.Measurement>()
               };
            //var measurements = new List<Measurement>();
            //if (request.Take != 0)
            //{
            //    measurements = DataContext.Measurements.OrderBy(x => x.Id).Skip(request.Skip).Take(request.Take).ToList();
            //}
            //else
            //{
            //    measurements = DataContext.Measurements.OrderBy(x => x.Id).ToList();
            //}
            //var response = new GetMeasurementsResponse();
            //response.Measurements = measurements.MapTo<GetMeasurementsResponse.Measurement>();
            //return response;
        }