Browse Source
Merge pull request #16723 from abpframework/Onur/kibana-errors
Blog - Edited blog name null check
pull/16727/head
Engincan VESKE
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
12 additions and
2 deletions
-
modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Blogs/BlogAppService.cs
-
modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Index.cshtml.cs
|
|
|
@ -32,7 +32,7 @@ namespace Volo.Blogging.Blogs |
|
|
|
Check.NotNullOrWhiteSpace(shortName, nameof(shortName)); |
|
|
|
|
|
|
|
var blog = await BlogRepository.FindByShortNameAsync(shortName); |
|
|
|
|
|
|
|
|
|
|
|
if (blog == null) |
|
|
|
{ |
|
|
|
throw new EntityNotFoundException(typeof(Blog), shortName); |
|
|
|
|
|
|
|
@ -1,7 +1,9 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; |
|
|
|
using Volo.Abp.Domain.Entities; |
|
|
|
using Volo.Blogging.Blogs; |
|
|
|
using Volo.Blogging.Blogs.Dtos; |
|
|
|
using Volo.Blogging.Pages.Blogs.Shared.Helpers; |
|
|
|
@ -43,7 +45,15 @@ namespace Volo.Blogging.Pages.Blog.Posts |
|
|
|
return NotFound(); |
|
|
|
} |
|
|
|
|
|
|
|
Blog = await _blogAppService.GetByShortNameAsync(BlogShortName); |
|
|
|
try |
|
|
|
{ |
|
|
|
Blog = await _blogAppService.GetByShortNameAsync(BlogShortName); |
|
|
|
} |
|
|
|
catch (EntityNotFoundException) |
|
|
|
{ |
|
|
|
return RedirectToPage("/Blogs/Index"); |
|
|
|
} |
|
|
|
|
|
|
|
Posts = (await _postAppService.GetListByBlogIdAndTagNameAsync(Blog.Id, TagName)).Items; |
|
|
|
PopularTags = (await _tagAppService.GetPopularTagsAsync(Blog.Id, new GetPopularTagsInput {ResultCount = 10, MinimumPostCount = 2})); |
|
|
|
|
|
|
|
|