Browse Source

refactoring

pull/16313/head
Onur Pıçakcı 3 years ago
parent
commit
61e79c7366
  1. 2
      modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Members/IMemberAppService.cs
  2. 4
      modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Members/MemberAppService.cs
  3. 28
      modules/blogging/src/Volo.Blogging.HttpApi.Client/ClientProxies/MembersClientProxy.Generated.cs
  4. 7
      modules/blogging/src/Volo.Blogging.HttpApi.Client/ClientProxies/MembersClientProxy.cs
  5. 2
      modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs
  6. 2
      modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml
  7. 2
      modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml.cs

2
modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Members/IMemberAppService.cs

@ -6,5 +6,5 @@ namespace Volo.Blogging.Members;
public interface IMemberAppService : IApplicationService
{
Task<BlogUserDto> GetAsync(string username);
Task<BlogUserDto> FindAsync(string username);
}

4
modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Members/MemberAppService.cs

@ -15,9 +15,9 @@ public class MemberAppService : BloggingAppServiceBase, IMemberAppService
_userRepository = userRepository;
}
public async Task<BlogUserDto> GetAsync(string username)
public async Task<BlogUserDto> FindAsync(string username)
{
var user = await _userRepository.GetAsync(x => x.UserName == username);
var user = await _userRepository.FindAsync(x => x.UserName == username);
return ObjectMapper.Map<BlogUser, BlogUserDto>(user);
}

28
modules/blogging/src/Volo.Blogging.HttpApi.Client/ClientProxies/MembersClientProxy.Generated.cs

@ -0,0 +1,28 @@
// This file is automatically generated by ABP framework to use MVC Controllers from CSharp
using System;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Http.Client;
using Volo.Abp.Http.Modeling;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Http.Client.ClientProxying;
using Volo.Blogging.Blogs;
using Volo.Blogging.Blogs.Dtos;
using Volo.Blogging.Members;
using Volo.Blogging.Posts;
// ReSharper disable once CheckNamespace
namespace Volo.Blogging.ClientProxies;
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IMemberAppService), typeof(MembersClientProxy))]
public partial class MembersClientProxy : ClientProxyBase<IMemberAppService>, IMemberAppService
{
public Task<BlogUserDto> FindAsync(string username)
{
return RequestAsync<BlogUserDto>(nameof(FindAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), username }
});
}
}

7
modules/blogging/src/Volo.Blogging.HttpApi.Client/ClientProxies/MembersClientProxy.cs

@ -0,0 +1,7 @@
// This file is part of MembersClientProxy, you can customize it here
// ReSharper disable once CheckNamespace
namespace Volo.Blogging.ClientProxies;
public partial class MembersClientProxy
{
}

2
modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs

@ -62,7 +62,7 @@ namespace Volo.Blogging.Posts
public async Task<List<Post>> GetListByUserIdAsync(Guid userId, CancellationToken cancellationToken = default)
{
var query = (await GetMongoQueryableAsync(cancellationToken)).Where(x => x.CreatorId == userId)
.OrderBy(x => x.CreationTime);
.OrderByDescending(x => x.CreationTime);
return await query.ToListAsync(GetCancellationToken(cancellationToken));
}

2
modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml

@ -66,7 +66,7 @@
</h3>
<p class="post-desc">
<a href="@Model.GetBlogPostUrl(post)">
@(post.Description.Length >= 150 ? post.Description.Substring(0, 150) + "..." : post.Description)
@post.Description.TruncateWithPostfix(150)
</a>
<a href="@Model.GetBlogPostUrl(post)" class="readMore">@L["ReadMore"]</a>
</p>

2
modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml.cs

@ -32,7 +32,7 @@ public class IndexModel : AbpPageModel
public async Task<IActionResult> OnGetAsync(string userName)
{
User = await _memberAppService.GetAsync(userName);
User = await _memberAppService.FindAsync(userName);
if (User is null)
{

Loading…
Cancel
Save