示例#1
0
        public virtual async Task <ActionResult> Index(int id)
        {
            var post = await _postService.GetPost(id);

            await _unitOfWork.SaveAllChangesAsync(false);

            ViewBag.Keywords = post.CategoryName;

            ViewBag.MetaDescription = post.MetaDescription;

            ViewBag.Author = post.AuthorName;

            ViewBag.LastModified = post.PostedDate.ToUniversalTime().ToString("ddd MMM dd yyyy HH:mm:ss \"GMT\"K");

            if (post.CategoryId.HasValue)
            {
                ViewData["SimilarProducts"] = LuceneIndex.GetMoreLikeThisPostItems(id)
                                              .Where(item => item.Category != "کالا‌ها").Skip(1).Take(8).ToList();
            }

            return(View(post));
        }