public OrderCollectionResponse Fetch(OrderQueryCollectionRequest request) { base.FixupLimitAndPagingOnRequest(request); var totalItemCount = 0; var sortExpression = RepositoryHelper.ConvertStringToSortExpression(EntityType, request.Sort); var includeFields = RepositoryHelper.ConvertStringToExcludedIncludedFields(EntityType, request.Select); var prefetchPath = RepositoryHelper.ConvertStringToPrefetchPath(EntityType, request.Include, request.Select); var predicateBucket = RepositoryHelper.ConvertStringToRelationPredicateBucket(EntityType, request.Filter, request.Relations); EntityCollection <OrderEntity> entities; using (var adapter = DataAccessAdapterFactory.NewDataAccessAdapter()) { OnBeforeFetchOrderQueryCollectionRequest(adapter, request, sortExpression, includeFields, prefetchPath, predicateBucket, request.PageNumber, request.PageSize, request.Limit); entities = base.Fetch(adapter, sortExpression, includeFields, prefetchPath, predicateBucket, request.PageNumber, request.PageSize, request.Limit, request.RCache, out totalItemCount); OnAfterFetchOrderQueryCollectionRequest(adapter, request, entities, sortExpression, includeFields, prefetchPath, predicateBucket, request.PageNumber, request.PageSize, request.Limit, totalItemCount); } var response = new OrderCollectionResponse(entities.ToDtoCollection(), request.PageNumber, request.PageSize, totalItemCount); return(response); }
public async Task <IActionResult> GetOrders([FromQuery] GetOrdersRequest getOrdersRequest) { QueryOrderRequest queryOrderRequest = getOrdersRequest != null ? new QueryOrderRequest(getOrdersRequest.Offset, getOrdersRequest.Take ) { OrderId = getOrdersRequest.OrderId } : null; OrderCollectionResponse orderCollectionResponse = await _orderService.QueryOrderAsync(queryOrderRequest); return(StatusCode((int)HttpStatusCode.OK, orderCollectionResponse)); }
public static OrderCollectionResponse CreateDummyData() { var product = new Line { Quantity = "20", MerchantProductNo = "MSGH1-S", Gtin = "1234567890" }; var productSecond = new Line { Quantity = "5", MerchantProductNo = "MSGH1-X", Gtin = "1234567890" }; var productSecondThird = new Line { Quantity = "4", MerchantProductNo = "MSGH1-M", Gtin = "1234567890" }; var productSecondFourth = new Line { Quantity = "3", MerchantProductNo = "MSGH1-M1", Gtin = "1234567890" }; var productSecondFifth = new Line { Quantity = "2", MerchantProductNo = "MSGH1-M2", Gtin = "1234567890" }; var productSecondSixth = new Line { Quantity = "1", MerchantProductNo = "MSGH1-M3", Gtin = "1234567890" }; var order = new Order { Lines = new Line[2] { product, productSecond } }; var order2 = new Order { Lines = new Line[4] { productSecondThird, productSecondFourth, productSecondFifth, productSecondSixth } }; var response = new OrderCollectionResponse { Content = new Order[2] { order, order2 }, Success = true }; return(response); }