Browse Source

Blogging module: controllers refactor & fixes

pull/751/head
Yunus Emre Kalkan 8 years ago
parent
commit
2d5f664739
  1. 4
      modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/BlogsController.cs
  2. 19
      modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/CommentsController.cs
  3. 16
      modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs
  4. 3
      modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/TagsController.cs

4
modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/BlogsController.cs

@ -12,10 +12,7 @@ namespace Volo.Blogging
{ {
[RemoteService] [RemoteService]
[Area("blogging")] [Area("blogging")]
[Controller]
[ControllerName("Blogs")]
[Route("api/blogging/blogs")] [Route("api/blogging/blogs")]
[DisableAuditing]
public class BlogsController : AbpController, IBlogAppService public class BlogsController : AbpController, IBlogAppService
{ {
private readonly IBlogAppService _blogAppService; private readonly IBlogAppService _blogAppService;
@ -66,6 +63,7 @@ namespace Volo.Blogging
} }
[HttpDelete] [HttpDelete]
[Route("{id}")]
public async Task Delete(Guid id) public async Task Delete(Guid id)
{ {
await _blogAppService.Delete(id); await _blogAppService.Delete(id);

19
modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/CommentsController.cs

@ -13,33 +13,38 @@ namespace Volo.Blogging
{ {
[RemoteService] [RemoteService]
[Area("blogging")] [Area("blogging")]
[Controller]
[ControllerName("Comments")]
[Route("api/blogging/comments")] [Route("api/blogging/comments")]
[DisableAuditing]
public class CommentsController : AbpController, ICommentAppService public class CommentsController : AbpController, ICommentAppService
{ {
private readonly ICommentAppService _commentAppService;
public CommentsController(ICommentAppService commentAppService)
{
_commentAppService = commentAppService;
}
[HttpGet] [HttpGet]
[Route("{postId}")] [Route("hierarchical/{postId}")]
public Task<List<CommentWithRepliesDto>> GetHierarchicalListOfPostAsync(Guid postId) public Task<List<CommentWithRepliesDto>> GetHierarchicalListOfPostAsync(Guid postId)
{ {
throw new NotImplementedException(); return _commentAppService.GetHierarchicalListOfPostAsync(postId);
} }
[HttpPost] [HttpPost]
public Task<CommentWithDetailsDto> CreateAsync(CreateCommentDto input) public Task<CommentWithDetailsDto> CreateAsync(CreateCommentDto input)
{ {
throw new NotImplementedException(); return _commentAppService.CreateAsync(input);
} }
[HttpPut] [HttpPut]
[Route("{id}")] [Route("{id}")]
public Task<CommentWithDetailsDto> UpdateAsync(Guid id, UpdateCommentDto input) public Task<CommentWithDetailsDto> UpdateAsync(Guid id, UpdateCommentDto input)
{ {
throw new NotImplementedException(); return _commentAppService.UpdateAsync(id, input);
} }
[HttpDelete] [HttpDelete]
[Route("{id}")]
public Task DeleteAsync(Guid id) public Task DeleteAsync(Guid id)
{ {
throw new NotImplementedException(); throw new NotImplementedException();

16
modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs

@ -11,10 +11,7 @@ namespace Volo.Blogging
{ {
[RemoteService] [RemoteService]
[Area("blogging")] [Area("blogging")]
[Controller]
[ControllerName("Posts")]
[Route("api/blogging/posts")] [Route("api/blogging/posts")]
[DisableAuditing]
public class PostsController : AbpController, IPostAppService public class PostsController : AbpController, IPostAppService
{ {
private readonly IPostAppService _postAppService; private readonly IPostAppService _postAppService;
@ -45,12 +42,6 @@ namespace Volo.Blogging
return _postAppService.GetAsync(id); return _postAppService.GetAsync(id);
} }
[HttpDelete]
public Task DeleteAsync(Guid id)
{
return _postAppService.DeleteAsync(id);
}
[HttpPost] [HttpPost]
public Task<PostWithDetailsDto> CreateAsync(CreatePostDto input) public Task<PostWithDetailsDto> CreateAsync(CreatePostDto input)
{ {
@ -63,5 +54,12 @@ namespace Volo.Blogging
{ {
return _postAppService.UpdateAsync(id, input); return _postAppService.UpdateAsync(id, input);
} }
[HttpDelete]
[Route("{id}")]
public Task DeleteAsync(Guid id)
{
return _postAppService.DeleteAsync(id);
}
} }
} }

3
modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/TagsController.cs

@ -12,10 +12,7 @@ namespace Volo.Blogging
{ {
[RemoteService] [RemoteService]
[Area("blogging")] [Area("blogging")]
[Controller]
[ControllerName("Tags")]
[Route("api/blogging/tags")] [Route("api/blogging/tags")]
[DisableAuditing]
public class TagsController : AbpController, ITagAppService public class TagsController : AbpController, ITagAppService
{ {
private readonly ITagAppService _tagAppService; private readonly ITagAppService _tagAppService;

Loading…
Cancel
Save