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), }); }
public async Task <IEnumerable <StockType> > GetStockTypesAsync() => await _context.GetAllAsync <StockType>();
public async Task <IEnumerable <UnitOfMeasure> > GetUnitOfMeasuresAsync() => await _context.GetAllAsync <UnitOfMeasure>();
public async Task <IEnumerable <StockItem> > GetStockItemsAsync() => await _context.GetAllAsync <StockItem>();
public async Task <IEnumerable <PurchaseOrderItem> > GetPurchaseOrderItemsAsync(Expression <Func <PurchaseOrderItem, bool> > expression) => await _context.GetAllAsync(expression);
public async Task <IEnumerable <PaymentType> > GetPaymentTypesAsync() => await _context.GetAllAsync <PaymentType>();
public async Task <IEnumerable <TransactionType> > GetTransactionTypesAsync() => await _context.GetAllAsync <TransactionType>();
public async Task <IEnumerable <GoodsReceivedNote> > GetGoodsReceivedNotesAsync() => await _context.GetAllAsync <GoodsReceivedNote>();
public async Task <IEnumerable <GoodsReceivedNoteItem> > GetGoodsReceivedNoteItemsAsync(Expression <Func <GoodsReceivedNoteItem, bool> > expression) => await _context.GetAllAsync(expression);
public async Task <IEnumerable <PurchaseOrder> > GetPurchaseOrdersAsync(Expression <Func <PurchaseOrder, bool> >?expression = null) => await _context.GetAllAsync(expression);