Beispiel #1
0
        public async Task <IPagingResponse <Warehouse> > GetWarehousesAsync(Int32 pageSize = 10, Int32 pageNumber = 1)
        {
            Logger?.LogInformation("{0} has been invoked", nameof(GetWarehousesAsync));

            var response = new PagingResponse <Warehouse>();

            try
            {
                // Get query
                var query = ProductionRepository.GetWarehouses();

                // Set information for paging
                response.PageSize   = (Int32)pageSize;
                response.PageNumber = (Int32)pageNumber;
                response.ItemsCount = await query.CountAsync();

                // Retrieve items, set model for response
                response.Model = await query.Paging(pageSize, pageNumber).ToListAsync();
            }
            catch (Exception ex)
            {
                response.SetError(ex, Logger);
            }

            return(response);
        }
        public async Task <IPagingResponse <OrderInfo> > GetOrdersAsync(Int32 pageSize = 10, Int32 pageNumber = 1, Int16?currencyID = null, Int32?customerID = null, Int32?employeeID = null, Int16?orderStatusID = null, Guid?paymentMethodID = null, Int32?shipperID = null)
        {
            Logger?.LogInformation("{0} has been invoked", nameof(GetOrdersAsync));

            var response = new PagingResponse <OrderInfo>();

            try
            {
                // Get query
                var query = SalesRepository
                            .GetOrders(currencyID, customerID, employeeID, orderStatusID, paymentMethodID, shipperID);

                // Set information for paging
                response.PageSize   = (Int32)pageSize;
                response.PageNumber = (Int32)pageNumber;
                response.ItemsCount = await query.CountAsync();

                // Retrieve items, set model for response
                response.Model = await query
                                 .Paging(pageSize, pageNumber)
                                 .ToListAsync();
            }
            catch (Exception ex)
            {
                response.SetError(ex, Logger);
            }

            return(response);
        }