public async Task <IEnumerable <ShopperViewModel> > GetShoppersByGender(Gender gender)
        {
            var findShopperQuery = new FindShopperQuery(Guid.Empty, gender);
            var shoppers         = await this.findShopperRepository.GetAllAsync(findShopperQuery);

            return(shopperAdapter.Adapt(shoppers, typeMapper));
        }
        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));
        }
        public async Task <IEnumerable <Shopper> > GetShoppersByGenderAsync(Gender gender)
        {
            var findShopperQuery = new FindShopperQuery(Guid.Empty, gender);

            return(await GetAllAsync(findShopperQuery));
        }
        public async Task <Shopper> GetAsync(Guid shopperID)
        {
            var findShopperQuery = new FindShopperQuery(shopperID, Gender.None);

            return((await GetAllAsync(findShopperQuery)).FirstOrDefault <Shopper>());
        }
Beispiel #5
0
        private async Task <bool> FindShopperByID(Guid shopperID)
        {
            var findShopperQuery = new FindShopperQuery(shopperID, domain.Enum.Gender.None);

            return(await this.shopperQuery.GetAsync(findShopperQuery) != null);
        }