コード例 #1
0
ファイル: PostController.cs プロジェクト: BogTodES/BlogAppV1
        public IActionResult PostWith(long postId)
        {
            var post = postService.PostWithId(postId);

            if (post is null)
            {
                return(NotFound("The Post you are looking for has been deleted or is inaccessible"));
            }

            var tempComms = postService.CommentsOfPost(postId).ToList();
            var poster    = postService.GetPosterInfo(postId);

            return(View("PostDetailsPage", new PostDetailsVm()
            {
                Id = post.Id,
                Title = post.Title,
                Body = post.Body,
                Date = post.Date,
                SectId = post.SectionId,
                OwnerId = poster.PosterId,
                OwnerUsername = poster.PosterUsername,
                PhotoId = post.PhotoId,
                Comments = tempComms
            }));
        }