//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)); }
public async Task <IViewComponentResult> InvokeAsync() { var blogPostsDto = await _blogDal.GetAllBlogPosts(); var output = blogPostsDto.Select(BlogPostViewModel.MapTo); return(View(output)); }