Пример #1
0
        public PartialViewResult CommentPartial(PostVM.PostDetailVM postVM)
        {
            List <CommentVM> listCommentVM = new List <CommentVM>();

            if (postVM.ListComment.Any())
            {
                CheckStateComment(postVM.ListComment.ToList());
                return(PartialView("_CommentPartial", postVM.ListComment.AsEnumerable()));
            }
            else
            {
                CommentVM commentVM = new CommentVM();
                commentVM.PostId = postVM.PostId;
                listCommentVM.Add(commentVM);
            }
            return(PartialView("_CommentPartial", listCommentVM.AsEnumerable()));
        }
Пример #2
0
        public ActionResult Details(int?id, string slug)
        {
            if (string.IsNullOrEmpty(slug))
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PostDTO postDTO = _iapiResponse.Get <PostDTO>("posts/" + id + "?slug=" + slug);

            PostVM.PostDetailVM postVM = _imapper.Map <PostDTO, PostVM.PostDetailVM>(postDTO);
            postVM.ListComment = _imapper.Map <List <CommentDTO>, List <CommentVM> >(postDTO.ListCommentDTO);
            postVM.IsMySelf    = _iapiResponse.Get <bool>("posts/" + id + "?email=" + User.Identity.GetUserName());
            TempData["Url"]    = slug;
            if (postVM == null)
            {
                return(HttpNotFound());
            }
            return(View(postVM));
        }