Exemple #1
0
 public GetKpiToSeriesResponse GetKpiToSeries(GetKpiToSeriesRequest request)
 {
     if (request.MeasurementId != 0)
     {
         return new GetKpiToSeriesResponse
         {
             KpiList = DataContext.Kpis
             .Include(x => x.Measurement)
             .Where(x => x.Name.Contains(request.Term) && x.Measurement.Id == request.MeasurementId).Take(20).ToList()
             .MapTo<GetKpiToSeriesResponse.Kpi>()
         };
     }
     else
     {
         return new GetKpiToSeriesResponse
        {
            KpiList = DataContext.Kpis
            .Include(x => x.Measurement)
            .Where(x => x.Name.Contains(request.Term)).Take(20).ToList()
            .MapTo<GetKpiToSeriesResponse.Kpi>()
        };
     }
 }
Exemple #2
0
 public GetKpiToSeriesResponse GetKpiToSeries(GetKpiToSeriesRequest request)
 {
     if (request.MeasurementId != 0)
     {
         var query =  DataContext.Kpis
             .Include(x => x.Measurement)
             .Where(x => x.Name.Contains(request.Term) && x.Measurement.Id == request.MeasurementId);
         if(request.OnlyCorporate){
             query = query.Where(x => x.Type.Name == "Corporate Portfolio");
         }
         return new GetKpiToSeriesResponse
         {
             KpiList =query.Take(20).ToList()
             .MapTo<GetKpiToSeriesResponse.Kpi>()
         };
     }
     else
     {
         var query =  DataContext.Kpis
            .Include(x => x.Measurement)
            .Where(x => x.Name.Contains(request.Term));
         if(request.OnlyCorporate){
             query = query.Where(x => x.Type.Name == "Corporate Portfolio");
         }
         return new GetKpiToSeriesResponse
        {
            KpiList =query.Take(20).ToList()
            .MapTo<GetKpiToSeriesResponse.Kpi>()
        };
     }
 }