コード例 #1
0
        public async Task <CollectionEnvelop <Supplier> > GetSuppliersAsync(string name, string city, string contactPerson, int page, int itemsPerPage)
        {
            var suppliers = await _context.GetAllAsync <Supplier>();

            if (!string.IsNullOrWhiteSpace(name))
            {
                suppliers = suppliers.Where(d => d.Name.Contains(name, StringComparison.InvariantCultureIgnoreCase));
            }

            if (!string.IsNullOrWhiteSpace(city))
            {
                suppliers = suppliers.Where(d => d.City.Equals(city, StringComparison.InvariantCultureIgnoreCase));
            }

            if (!string.IsNullOrWhiteSpace(contactPerson))
            {
                suppliers = suppliers.Where(d => d.ContactPerson !.Equals(contactPerson, StringComparison.InvariantCultureIgnoreCase));
            }

            var toSkip = page * itemsPerPage;

            return(new CollectionEnvelop <Supplier>
            {
                TotalItems = suppliers.Count(),
                ItemsPerPage = itemsPerPage,
                Items = page == 0 ? suppliers.OrderBy(d => d.Name).AsQueryable().Take(itemsPerPage) :
                        suppliers.OrderBy(d => d.Name).AsQueryable().Skip(toSkip).Take(itemsPerPage),
            });
        }
コード例 #2
0
 public async Task <IEnumerable <StockType> > GetStockTypesAsync() => await _context.GetAllAsync <StockType>();
コード例 #3
0
 public async Task <IEnumerable <UnitOfMeasure> > GetUnitOfMeasuresAsync() => await _context.GetAllAsync <UnitOfMeasure>();
コード例 #4
0
 public async Task <IEnumerable <StockItem> > GetStockItemsAsync() => await _context.GetAllAsync <StockItem>();
コード例 #5
0
 public async Task <IEnumerable <PurchaseOrderItem> > GetPurchaseOrderItemsAsync(Expression <Func <PurchaseOrderItem, bool> > expression) => await _context.GetAllAsync(expression);
コード例 #6
0
 public async Task <IEnumerable <PaymentType> > GetPaymentTypesAsync() => await _context.GetAllAsync <PaymentType>();
コード例 #7
0
 public async Task <IEnumerable <TransactionType> > GetTransactionTypesAsync() => await _context.GetAllAsync <TransactionType>();
コード例 #8
0
 public async Task <IEnumerable <GoodsReceivedNote> > GetGoodsReceivedNotesAsync() => await _context.GetAllAsync <GoodsReceivedNote>();
コード例 #9
0
 public async Task <IEnumerable <GoodsReceivedNoteItem> > GetGoodsReceivedNoteItemsAsync(Expression <Func <GoodsReceivedNoteItem, bool> > expression) => await _context.GetAllAsync(expression);
コード例 #10
0
 public async Task <IEnumerable <PurchaseOrder> > GetPurchaseOrdersAsync(Expression <Func <PurchaseOrder, bool> >?expression = null) => await _context.GetAllAsync(expression);