// GET api/lots public LotSummariesResponse Get(LotTypeEnum?lotType = null, LotProductionStatus?productionStatus = null, LotQualityStatus?qualityStatus = null, string productKey = null, DateTime?productionStart = null, DateTime?productionEnd = null, string startingLotKey = null, string productSubType = null, int?pageSize = 50, int?skipCount = 0) { if (productionEnd.HasValue && productionStart.HasValue && productionStart.Value > productionEnd.Value) { var temp = productionStart.Value; productionStart = productionEnd; productionEnd = temp; } var filterParams = string.IsNullOrWhiteSpace(startingLotKey) ? new FilterLotParameters { ProductType = ProductTypeEnum.Chile, LotType = lotType, ProductionStartRangeStart = productionStart.HasValue ? productionStart.Value.ToUniversalTime() : (DateTime?)null, ProductionStartRangeEnd = productionEnd.HasValue ? productionEnd.Value.ToUniversalTime() : productionStart.HasValue ? DateTime.Now.ToUniversalTime() : (DateTime?)null, ProductionStatus = productionStatus, QualityStatus = qualityStatus, ProductKey = productKey } : new FilterLotParameters { StartingLotKey = startingLotKey, }; var result = _lotService.GetLotSummaries(filterParams); result.EnsureSuccessWithHttpResponseException(); var lotQuery = result.ResultingObject.LotSummaries; if (!string.IsNullOrWhiteSpace(productSubType)) { lotQuery = lotQuery.Where(l => l.LotProduct.ProductSubType == productSubType); } if (!productionStart.HasValue && string.IsNullOrWhiteSpace(startingLotKey)) { lotQuery = lotQuery.OrderByDescending(l => l.LotDateCreated); } //var total = lotQuery.Count(); var lotSummaries = lotQuery .PageResults(pageSize, skipCount) .Project().To <LotQualitySummaryResponse>(); return(new LotSummariesResponse { AttributeNamesByProductType = result.ResultingObject.AttributeNamesByProductType, LotSummaries = lotSummaries, //Total = total }); }
public IDictionary <int, IEnumerable <KeyValuePair <string, string> > > Get() { var result = _lotService.GetLotSummaries(); result.EnsureSuccessWithHttpResponseException(); return(result.ResultingObject.AttributeNamesByProductType.ToDictionary(k => (int)k.Key, v => v.Value)); }