public object GetAggregationData(GetAggregationDataRequest request) { var resp = _agregationManager.GetAgregations(Entities.Enums.PeriodType.Daily, this.getFromDate(request.TimeRangeType), request.AgregationBy); switch (request.AgregationBy) { case Entities.Enums.AgregationBy.Customer: return(new GetCustomerAggregationDataResponse { AggregationCustomerDatas = resp.Select(x => new AggregationCustomerDataItem { AggregationDataItem = this.convert(x), AggregationCustomerData = this.convert(_customerManager.Get(_tagManager.UnTag <int>(x.Tag, AgregationConstants.CustomerId))) }).ToList() }); case Entities.Enums.AgregationBy.Catering: return(new GetCateringAggregationDataResponse { AggregationCateringDataItems = resp.Select(x => new AggregationCateringDataItem { AggregationDataItem = this.convert(x), AggregationCateringData = this.convert(_cateringManager.Get(_tagManager.UnTag <int>(x.Tag, AgregationConstants.CateringId))) }).ToList() }); case Entities.Enums.AgregationBy.CustomerCatering: return(new GetCustomerCateringAggregationDataResponse { AggregationCustomerAndCateringDatas = resp.Select(x => new AggregationCustomerAndCateringDataItem { AggregationDataItem = this.convert(x), AggregationCateringData = this.convert(_cateringManager.Get(_tagManager.UnTag <int>(x.Tag, AgregationConstants.CateringId))), AggregationCustomerData = this.convert(_customerManager.Get(_tagManager.UnTag <int>(x.Tag, AgregationConstants.CustomerId))) }).ToList() }); } return(null); }
public IActionResult GetAggregations([FromQuery] GetAggregationDataRequest request) { return(Ok(_aggregationService.GetAggregationData(request))); }