Browse Source

Merge pull request #751 from abpframework/Blogging-Controllers

Blogging module: added missing controllers
pull/765/head
Halil İbrahim Kalkan 8 years ago
committed by GitHub
parent
commit
d16bb61b2e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/BlogsController.cs
  2. 53
      modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/CommentsController.cs
  3. 65
      modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs
  4. 32
      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);

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

@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Auditing;
using Volo.Blogging.Comments;
using Volo.Blogging.Comments.Dtos;
namespace Volo.Blogging
{
[RemoteService]
[Area("blogging")]
[Route("api/blogging/comments")]
public class CommentsController : AbpController, ICommentAppService
{
private readonly ICommentAppService _commentAppService;
public CommentsController(ICommentAppService commentAppService)
{
_commentAppService = commentAppService;
}
[HttpGet]
[Route("hierarchical/{postId}")]
public Task<List<CommentWithRepliesDto>> GetHierarchicalListOfPostAsync(Guid postId)
{
return _commentAppService.GetHierarchicalListOfPostAsync(postId);
}
[HttpPost]
public Task<CommentWithDetailsDto> CreateAsync(CreateCommentDto input)
{
return _commentAppService.CreateAsync(input);
}
[HttpPut]
[Route("{id}")]
public Task<CommentWithDetailsDto> UpdateAsync(Guid id, UpdateCommentDto input)
{
return _commentAppService.UpdateAsync(id, input);
}
[HttpDelete]
[Route("{id}")]
public Task DeleteAsync(Guid id)
{
throw new NotImplementedException();
}
}
}

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

@ -0,0 +1,65 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Auditing;
using Volo.Blogging.Posts;
namespace Volo.Blogging
{
[RemoteService]
[Area("blogging")]
[Route("api/blogging/posts")]
public class PostsController : AbpController, IPostAppService
{
private readonly IPostAppService _postAppService;
public PostsController(IPostAppService postAppService)
{
_postAppService = postAppService;
}
[HttpGet]
[Route("{blogId}/all")]
public Task<ListResultDto<PostWithDetailsDto>> GetListByBlogIdAndTagName(Guid blogId, string tagName)
{
return _postAppService.GetListByBlogIdAndTagName(blogId, tagName);
}
[HttpGet]
[Route("read/{id}")]
public Task<PostWithDetailsDto> GetForReadingAsync(GetPostInput input)
{
return _postAppService.GetForReadingAsync(input);
}
[HttpGet]
[Route("{id}")]
public Task<PostWithDetailsDto> GetAsync(Guid id)
{
return _postAppService.GetAsync(id);
}
[HttpPost]
public Task<PostWithDetailsDto> CreateAsync(CreatePostDto input)
{
return _postAppService.CreateAsync(input);
}
[HttpPut]
[Route("{id}")]
public Task<PostWithDetailsDto> UpdateAsync(Guid id, UpdatePostDto input)
{
return _postAppService.UpdateAsync(id, input);
}
[HttpDelete]
[Route("{id}")]
public Task DeleteAsync(Guid id)
{
return _postAppService.DeleteAsync(id);
}
}
}

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

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Auditing;
using Volo.Blogging.Tagging;
using Volo.Blogging.Tagging.Dtos;
namespace Volo.Blogging
{
[RemoteService]
[Area("blogging")]
[Route("api/blogging/tags")]
public class TagsController : AbpController, ITagAppService
{
private readonly ITagAppService _tagAppService;
public TagsController(ITagAppService tagAppService)
{
_tagAppService = tagAppService;
}
[HttpGet]
[Route("popular/{blogId}")]
public Task<List<TagDto>> GetPopularTags(Guid blogId, GetPopularTagsInput input)
{
return _tagAppService.GetPopularTags(blogId, input);
}
}
}
Loading…
Cancel
Save