// GET: AuthorController/Details/5
        public async Task <IActionResult> Details(int id)
        {
            PostDetailViewModel myPostDetailViewModel = new PostDetailViewModel();

            myPostDetailViewModel.BlogPost = await _blogPostRepository.GetByIdAsync(id);

            int authorId = myPostDetailViewModel.BlogPost.AuthorId;

            myPostDetailViewModel.Author = await _authorRepository.GetByIdAsync(authorId);

            myPostDetailViewModel.SiteUrl = _appSettings.Value.SiteUrl;
            List <BlogTag>        blogTagsFinalList   = new List <BlogTag>();
            List <BlogTagApplied> blogTagsForThisPost = await _blogTagAppliedRepository.GetAllByPostId(id, false);

            foreach (BlogTagApplied blogTagApplied in blogTagsForThisPost)
            {
                blogTagsFinalList.Add(await _blogTagRepository.GetByIdAsync(blogTagApplied.BlogTagId));
            }
            myPostDetailViewModel.BlogTags = blogTagsFinalList;
            return(View(myPostDetailViewModel));
        }
Пример #2
0
        // GET: AuthorController/Details/5
        public async Task <IActionResult> Details(int id)
        {
            var blogTagDetails = await _blogTagRepository.GetByIdAsync(id);

            return(View(blogTagDetails));
        }