diff --git a/RMuseum/Controllers/PDFLibraryController.cs b/RMuseum/Controllers/PDFLibraryController.cs
index 5037b9f9..528d7be2 100644
--- a/RMuseum/Controllers/PDFLibraryController.cs
+++ b/RMuseum/Controllers/PDFLibraryController.cs
@@ -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
{
+ ///
+ /// add a new book
+ ///
+ ///
+ ///
+
+ [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 AddBookAsync([FromBody] Book book)
+ {
+ var res = await _pdfService.AddBookAsync(book);
+ if (!string.IsNullOrEmpty(res.ExceptionString))
+ return BadRequest(res.ExceptionString);
+ return Ok(res.Result);
+ }
+
+ ///
+ /// add a new author
+ ///
+ ///
+ ///
+
+ [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 AddAuthorAsync([FromBody] Author author)
+ {
+ var res = await _pdfService.AddAuthorAsync(author);
+ if (!string.IsNullOrEmpty(res.ExceptionString))
+ return BadRequest(res.ExceptionString);
+ return Ok(res.Result);
+ }
+
+ ///
+ /// add a new mukti volume pdf collection
+ ///
+ ///
+ ///
+ [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 AddMultiVolumePDFCollection([FromBody] MultiVolumePDFCollection volumes)
+ {
+ var res = await _pdfService.AddMultiVolumePDFCollection(volumes);
+ if (!string.IsNullOrEmpty(res.ExceptionString))
+ return BadRequest(res.ExceptionString);
+ return Ok(res.Result);
+ }
+
///
/// PDF Service
///