Ejemplo n.º 1
0
        public void AddProductToSuggestionList(List <Product> products)
        {
            foreach (var product in products)
            {
                var productBySubCategoryList = _productDA.GetProductsBYSubCategory(product.ProductSubCategory);

                foreach (var pro in productBySubCategoryList)
                {
                    if (pro.ProductStatus == "Accepted")
                    {
                        var model  = _mapper.Map <Product, ProductModel>(pro);
                        var seller = _sellerDA.GetSellerByID(model.Seller_ID);
                        model.SellerName = seller.Name;
                        //add picture
                        model.PicturePath = _productDA.GetSingleProductPicture(pro.ID);
                        if (suggestedProductsList.FirstOrDefault(p => p.ID == model.ID) == null)
                        {
                            suggestedProductsList.Add(model);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void AddProductToSuggestionList(List <Product> products)
        {
            foreach (var product in products)
            {
                var productBySubCategoryList = _productDA.GetProductsBYSubCategory(product.ProductSubCategory);

                foreach (var pro in productBySubCategoryList)
                {
                    var model = _mapper.Map <Product, ProductModel>(pro);
                    if (suggestedProductsList.FirstOrDefault(p => p.ID == model.ID) == null)
                    {
                        suggestedProductsList.Add(model);
                    }
                }
            }
        }