Пример #1
0
        public ActionResult ById(int id)
        {
            var post = this.posts.GetById(id);
            var postModel = this.Mapper.Map<PostViewModel>(post);

            var like = this.likes.GetByUserAndPostId(this.User.Identity.GetUserId(), id);

            var model = new PostByIdViewModel
            {
                PostViewModel = postModel,
                PostLikedByCurrentUser = like != null
            };

            return this.PartialView("ById", model);
        }
Пример #2
0
        public ActionResult ById(int id)
        {
            var post      = this.posts.GetById(id);
            var postModel = this.Mapper.Map <PostViewModel>(post);

            var like = this.likes.GetByUserAndPostId(this.User.Identity.GetUserId(), id);

            var model = new PostByIdViewModel
            {
                PostViewModel          = postModel,
                PostLikedByCurrentUser = like != null
            };

            return(this.View("ById", model));
        }