refactoring

pull/16503/head
Onur Pıçakcı 2 years ago
parent 01a00589e8
commit 3a8834931b

@ -203,21 +203,22 @@ namespace Volo.Blogging.Posts
foreach (var postDto in postDtos)
{
if (postDto.CreatorId.HasValue)
if (!postDto.CreatorId.HasValue)
{
if (!userDictionary.ContainsKey(postDto.CreatorId.Value))
{
var creatorUser = await UserLookupService.FindByIdAsync(postDto.CreatorId.Value);
if (creatorUser != null)
{
userDictionary[creatorUser.Id] = ObjectMapper.Map<BlogUser, BlogUserDto>(creatorUser);
}
}
continue;
}
if (userDictionary.ContainsKey(postDto.CreatorId.Value))
{
postDto.Writer = userDictionary[(Guid)postDto.CreatorId];
}
if (userDictionary.TryGetValue(postDto.CreatorId.Value, out var creatorUserDto))
{
postDto.Writer = creatorUserDto;
continue;
}
var creatorUser = await UserLookupService.FindByIdAsync(postDto.CreatorId.Value);
if (creatorUser != null)
{
postDto.Writer = ObjectMapper.Map<BlogUser, BlogUserDto>(creatorUser);
userDictionary[creatorUser.Id] = postDto.Writer;
}
}

@ -129,6 +129,11 @@
</div>
</div>
</section>
<section class="post-content">
<p>
@Html.Raw(BloggingPageHelper.RenderMarkdownToHtml(Model.Post.Content))
</p>
</section>
</div>
<div class="col-12 col-md-4 col-lg-3">
<div class="list-group">
@ -210,19 +215,6 @@
</div>
</div>
<div class="row">
<div class="col-12 col-md-8 col-lg-8 mx-auto">
<section class="post-content">
<p>
@Html.Raw(BloggingPageHelper.RenderMarkdownToHtml(Model.Post.Content))
</p>
</section>
</div>
<div class="col-12 col-md-4 col-lg-3">
</div>
</div>
<div class="row">
<div class="col-12 col-md-8 col-lg-8 mx-auto">
@if (Model.Post.Tags.Count > 0)

Loading…
Cancel
Save