Exemplo n.º 1
0
        public async Task <bool> DoesProductAlreadyExist(string productId, string customerId)
        {
            var wlEntity = await GetWishListAsync(customerId);

            var wlServiceModel = new WishlistServiceModel();

            wlServiceModel.CustomerId = customerId;
            wlServiceModel.Id         = wlEntity.Id;

            return(_productsWishlistsService.ProductAlreadyExists(wlServiceModel, productId));
        }
Exemplo n.º 2
0
        public async Task <ICollection <ProductViewModel> > FindWishlistProductsByCustomerId(string customerId)
        {
            var wlEntity = await this.GetWishListAsync(customerId);

            var wlServiceModel = new WishlistServiceModel();

            wlServiceModel.CustomerId = customerId;
            wlServiceModel.Id         = wlEntity.Id;

            return(_productsWishlistsService.FindProductsByWishlist(wlServiceModel));
        }
        public ICollection <ProductViewModel> FindProductsByWishlist(WishlistServiceModel wishlist)
        {
            var wlists = this.Repository.All().Where(wl => wl.WishlistId == wishlist.Id);
            ICollection <ProductViewModel> wlProducts = new List <ProductViewModel>();

            foreach (var wl in wlists)
            {
                wlProducts.Add(_productService.FindById(wl.ProductId));
            }

            return(wlProducts);
        }
        public bool ProductAlreadyExists(WishlistServiceModel wlServiceModel, string productId)
        {
            ICollection <ProductsWishlists> productMatches = this.Repository
                                                             .All().Where(wl => wl.WishlistId == wlServiceModel.Id &&
                                                                          wl.ProductId == productId).ToList();

            if (productMatches.Count > 0)
            {
                return(true);
            }

            return(false);
        }