#399 AddMultiVolumePDFCollection
This commit is contained in:
parent
f8b5d125c1
commit
78ab602e50
@ -1,5 +1,11 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using RMuseum.Models.Auth.Memory;
|
||||
using RMuseum.Models.PDFLibrary;
|
||||
using RMuseum.Services;
|
||||
using RSecurityBackend.Models.Auth.Memory;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RMuseum.Controllers
|
||||
{
|
||||
@ -7,6 +13,59 @@ namespace RMuseum.Controllers
|
||||
[Route("api/pdf")]
|
||||
public class PDFLibraryController : Controller
|
||||
{
|
||||
/// <summary>
|
||||
/// add a new book
|
||||
/// </summary>
|
||||
/// <param name="book"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
[HttpPost("book")]
|
||||
[Authorize(Policy = RMuseumSecurableItem.PDFLibraryEntityShortName + ":" + SecurableItem.ModifyOperationShortName)]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(Book))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
public async Task<IActionResult> AddBookAsync([FromBody] Book book)
|
||||
{
|
||||
var res = await _pdfService.AddBookAsync(book);
|
||||
if (!string.IsNullOrEmpty(res.ExceptionString))
|
||||
return BadRequest(res.ExceptionString);
|
||||
return Ok(res.Result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// add a new author
|
||||
/// </summary>
|
||||
/// <param name="author"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
[HttpPost("author")]
|
||||
[Authorize(Policy = RMuseumSecurableItem.PDFLibraryEntityShortName + ":" + SecurableItem.ModifyOperationShortName)]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(Author))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
public async Task<IActionResult> AddAuthorAsync([FromBody] Author author)
|
||||
{
|
||||
var res = await _pdfService.AddAuthorAsync(author);
|
||||
if (!string.IsNullOrEmpty(res.ExceptionString))
|
||||
return BadRequest(res.ExceptionString);
|
||||
return Ok(res.Result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// add a new mukti volume pdf collection
|
||||
/// </summary>
|
||||
/// <param name="volumes"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("volumes")]
|
||||
[Authorize(Policy = RMuseumSecurableItem.PDFLibraryEntityShortName + ":" + SecurableItem.ModifyOperationShortName)]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(MultiVolumePDFCollection))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
public async Task<IActionResult> AddMultiVolumePDFCollection([FromBody] MultiVolumePDFCollection volumes)
|
||||
{
|
||||
var res = await _pdfService.AddMultiVolumePDFCollection(volumes);
|
||||
if (!string.IsNullOrEmpty(res.ExceptionString))
|
||||
return BadRequest(res.ExceptionString);
|
||||
return Ok(res.Result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PDF Service
|
||||
/// </summary>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user