예제 #1
0
        public virtual async Task <ActionResult> Index(int id)
        {
            var model = await _productService.GetProductPage(id);

            ViewData["SimilarProducts"] = LuceneIndex.GetMoreLikeThisProjectItems(id)
                                          .Where(item => item.Category == "کالا‌ها").Skip(1).Take(8).ToList();

            await _unitOfWork.SaveAllChangesAsync(false);

            var keywords = "";

            if (model.Categories != null && model.Categories.Any())
            {
                keywords = model.Categories.Aggregate(keywords, (current, category) => current + (category.Name + "-"));
            }

            keywords = keywords.Substring(0, keywords.Length - 1);

            ViewBag.Keywords = keywords;

            ViewBag.MetaDescription = model.MetaDescription;

            return(View(model));
        }