コード例 #1
0
        //GET: Blog
        public async Task <IActionResult> Index(bool createPost)
        {
            IEnumerable <BlogPostDto> blogPostsDto = new List <BlogPostDto>();

            blogPostsDto = await _blogDal.GetAllBlogPosts();

            var blogPostsModels = blogPostsDto.Select(BlogPostViewModel.MapTo);

            if (createPost == true)
            {
                ViewBag.Message = "Successfully created!";
            }

            return(View(blogPostsModels));
        }
コード例 #2
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var blogPostsDto = await _blogDal.GetAllBlogPosts();

            var output = blogPostsDto.Select(BlogPostViewModel.MapTo);

            return(View(output));
        }