Exemple #1
0
        public ActionResult Show(Guid id)
        {
            ArticleCommentVM model = new ArticleCommentVM();

            model.Article  = service.ArticleService.GetById(id);
            model.Comments = service.CommentService.GetDefault(x => x.ArticleID == id).OrderByDescending(x => x.AddDate).Take(10);
            model.Likes    = service.LikeService.GetDefault(z => z.ArticleID == id).Count();
            return(View(model));
        }
        public ActionResult Show(Guid id)
        {
            ArticleCommentVM model = new ArticleCommentVM()
            {
                Articles = service.ArticleService.GetActive(),

                AppUsers = service.AppUserService.GetActive(),

                Comments = service.CommentService.GetDefault(x => x.ArticleID == id).OrderByDescending(x => x.AddDate).Take(10),

                Likes = service.LikeService.GetDefault(x => x.ArticleID == id).Count(),
            };

            return(View(model));
        }
        public ActionResult ShowArticle(int?id)
        {
            if (id != null)
            {
                ArticleCommentVM art = new ArticleCommentVM();

                art.Article  = db.GetById((int)id);
                art.Likes    = likedb.get((int)id);
                art.Comments = cmdb.GetByArticleId((int)id, 10);
                return(View(art));
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }
        }