Beispiel #1
0
        public async Task <ActionResult> Details(string blogshortName, string url)
        {
            var blog = await _blogAppService.GetByShortNameAsync(blogshortName);

            if (blog == null)
            {
                return(RedirectToAction("E404", "Error"));
            }


            var postDetails = await _postAppService.GetForReadingAsync(new GetReadPostInput
            {
                BlogId = blog.Id,
                Url    = url
            });

            if (postDetails == null)
            {
                return(RedirectToAction("E404", "Error"));
            }


            ViewBag.BlogShortName = blogshortName;


            return(View(postDetails));
        }
        public async Task Should_Get_Fore_Reading()
        {
            var blogId     = (await _blogRepository.GetListAsync()).First().Id;
            var post       = (await _postRepository.GetListAsync()).First(p => p.BlogId == blogId);
            var postToRead = await _postAppService.GetForReadingAsync(new GetPostInput()
            {
                BlogId = blogId, Url = post.Url
            });

            postToRead.ShouldNotBeNull();
        }
        public async Task <IActionResult> OnGet()
        {
            var blog = await _blogAppService.GetByShortNameAsync(BlogShortName);

            if (blog == null)
            {
                return(RedirectToAction("E404", "Error"));
            }

            PostDetailsDto = await _postAppService.GetForReadingAsync(new GetReadPostInput
            {
                BlogId = blog.Id,
                Url    = Posturl
            });

            if (PostDetailsDto == null)
            {
                return(RedirectToAction("E404", "Error"));
            }

            return(Page());
        }
Beispiel #4
0
 public Task <PostWithDetailsDto> GetForReadingAsync(GetPostInput input)
 {
     return(_postAppService.GetForReadingAsync(input));
 }