public async Task <IEnumerable <Payment> > GetAllAsync(FindPaymentQuery findPaymentQuery) { var paymentFilter = EventFiltersDefinition <PaymentMongo> .ApplyPaymentIDFilter(findPaymentQuery.PaymentID); var merchantFilter = EventFiltersDefinition <PaymentMongo> .ApplyMerchantIDFilter(findPaymentQuery.MerchantID); var shopperFilter = EventFiltersDefinition <PaymentMongo> .ApplyShooperIDFilter(findPaymentQuery.ShopperID); var options = new FindOptions <PaymentMongo> { Sort = Builders <PaymentMongo> .Sort.Descending(p => p.DateCreated) }; var payments = await this.paymentEvents .FindAsync(paymentFilter& merchantFilter& shopperFilter, options) .Result.ToListAsync() .ConfigureAwait(false); return(this.typeMapper.Map <IEnumerable <Payment> >(payments)); }
public async Task <IEnumerable <Shopper> > GetAllAsync(FindShopperQuery findShopperQuery) { var filters = EventFiltersDefinition <ShopperMongo> .ApplyShooperIDFilter(findShopperQuery.ShopperID); if (findShopperQuery.Gender != Gender.None) { filters = Builders <ShopperMongo> .Filter.Eq(x => x.Gender, findShopperQuery.Gender); } var options = new FindOptions <ShopperMongo> { Sort = Builders <ShopperMongo> .Sort.Descending(p => p.DateCreated) }; var shoppers = await this.shopperRepository .FindAsync(filters, options) .Result.ToListAsync() .ConfigureAwait(false); return(this.typeMapper.Map <IEnumerable <Shopper> >(shoppers)); }