Blog: added redirect if blog name is null

pull/16723/head
Onur Pıçakcı 2 years ago
parent ad40b004d9
commit 9da4dc960a

@ -33,11 +33,6 @@ namespace Volo.Blogging.Blogs
var blog = await BlogRepository.FindByShortNameAsync(shortName);
if (blog == null)
{
throw new EntityNotFoundException(typeof(Blog), shortName);
}
return ObjectMapper.Map<Blog, BlogDto>(blog);
}

@ -44,6 +44,12 @@ namespace Volo.Blogging.Pages.Blog.Posts
}
Blog = await _blogAppService.GetByShortNameAsync(BlogShortName);
if (Blog == null)
{
return RedirectToPage("/Blogs/Index");
}
Posts = (await _postAppService.GetListByBlogIdAndTagNameAsync(Blog.Id, TagName)).Items;
PopularTags = (await _tagAppService.GetPopularTagsAsync(Blog.Id, new GetPopularTagsInput {ResultCount = 10, MinimumPostCount = 2}));

Loading…
Cancel
Save