mirror of https://github.com/abpframework/abp.git
8 changed files with 116 additions and 7 deletions
@ -0,0 +1,15 @@ |
|||||
|
using System; |
||||
|
|
||||
|
namespace Volo.CmsKit.Admin.Comments |
||||
|
{ |
||||
|
public class CmsUserDto |
||||
|
{ |
||||
|
public Guid Id { get; set; } |
||||
|
|
||||
|
public string UserName { get; set; } |
||||
|
|
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
public string Surname { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,40 @@ |
|||||
|
using System; |
||||
|
using System.Linq.Dynamic.Core; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.CmsKit.Comments; |
||||
|
using Volo.CmsKit.Users; |
||||
|
|
||||
|
namespace Volo.CmsKit.Admin.Comments |
||||
|
{ |
||||
|
public class CommentAdminAppService : CmsKitAdminAppServiceBase, ICommentAdminAppService |
||||
|
{ |
||||
|
protected readonly ICommentRepository CommentRepository; |
||||
|
|
||||
|
public CommentAdminAppService(ICommentRepository commentRepository) |
||||
|
{ |
||||
|
CommentRepository = commentRepository; |
||||
|
} |
||||
|
|
||||
|
public virtual Task<PagedResult<CommentDto>> GetListAsync(CommentGetListInput input) |
||||
|
{ |
||||
|
throw new System.NotImplementedException(); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<CommentWithAuthorDto> GetAsync(Guid id) |
||||
|
{ |
||||
|
var comment = await CommentRepository.GetWithAuthorAsync(id); |
||||
|
|
||||
|
var dto = ObjectMapper.Map<Comment, CommentWithAuthorDto>(comment.Comment); |
||||
|
dto.Author = ObjectMapper.Map<CmsUser, CmsUserDto>(comment.Author); |
||||
|
|
||||
|
return dto; |
||||
|
} |
||||
|
|
||||
|
public virtual async Task DeleteAsync(Guid id) |
||||
|
{ |
||||
|
var comment = await CommentRepository.GetAsync(id); |
||||
|
|
||||
|
await CommentRepository.DeleteWithRepliesAsync(comment); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue