#400 GetMultiVolumePDFCollectionByIdAsync
This commit is contained in:
parent
3a9116161c
commit
6e81b927d9
@ -15,7 +15,6 @@ using RSecurityBackend.Services;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using RMuseum.Models.Artifact;
|
||||
using RMuseum.Services.Implementation;
|
||||
|
||||
namespace RMuseum.Controllers
|
||||
{
|
||||
@ -349,13 +348,13 @@ namespace RMuseum.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// add new tag value to artifact
|
||||
/// add new tag value to pdf book
|
||||
/// </summary>
|
||||
/// <param name="pdfBookId"></param>
|
||||
/// <param name="tag">only name is processed</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("tagvalue/{pdfBookId}")]
|
||||
[Authorize(Policy = RMuseumSecurableItem.ArtifactEntityShortName + ":" + RMuseumSecurableItem.EditTagValueOperationShortName)]
|
||||
[Authorize(Policy = RMuseumSecurableItem.PDFLibraryEntityShortName + ":" + RMuseumSecurableItem.EditTagValueOperationShortName)]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(RTagValue))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
public async Task<IActionResult> TagPDFBookAsync(int pdfBookId, [FromBody] RTag tag)
|
||||
@ -377,7 +376,7 @@ namespace RMuseum.Controllers
|
||||
/// <param name="global">apply on all same value tags</param>
|
||||
/// <returns></returns>
|
||||
[HttpPut("tagvalue/{pdfBookId}/{global=true}")]
|
||||
[Authorize(Policy = RMuseumSecurableItem.ArtifactEntityShortName + ":" + RMuseumSecurableItem.EditTagValueOperationShortName)]
|
||||
[Authorize(Policy = RMuseumSecurableItem.PDFLibraryEntityShortName + ":" + RMuseumSecurableItem.EditTagValueOperationShortName)]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK)]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
[ProducesResponseType((int)HttpStatusCode.NotFound)]
|
||||
@ -405,7 +404,7 @@ namespace RMuseum.Controllers
|
||||
/// <param name="tagValueId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("tagvalue/{pdfBookId}/{tagValueId}")]
|
||||
[Authorize(Policy = RMuseumSecurableItem.ArtifactEntityShortName + ":" + RMuseumSecurableItem.EditTagValueOperationShortName)]
|
||||
[Authorize(Policy = RMuseumSecurableItem.PDFLibraryEntityShortName + ":" + RMuseumSecurableItem.EditTagValueOperationShortName)]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(bool))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
[ProducesResponseType((int)HttpStatusCode.Forbidden)]
|
||||
@ -454,58 +453,6 @@ namespace RMuseum.Controllers
|
||||
return Ok(itemsInfo.Result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// add a new book
|
||||
/// </summary>
|
||||
/// <param name="book"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
[HttpPost("book")]
|
||||
[Authorize(Policy = RMuseumSecurableItem.PDFLibraryEntityShortName + ":" + SecurableItem.AddOperationShortName)]
|
||||
[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>
|
||||
/// update book
|
||||
/// </summary>
|
||||
/// <param name="book"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut("book")]
|
||||
[Authorize(Policy = RMuseumSecurableItem.PDFLibraryEntityShortName + ":" + SecurableItem.ModifyOperationShortName)]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK)]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
public async Task<IActionResult> UpdateBookAsync([FromBody] Book book)
|
||||
{
|
||||
var res = await _pdfService.UpdateBookAsync(book);
|
||||
if (!string.IsNullOrEmpty(res.ExceptionString))
|
||||
return BadRequest(res.ExceptionString);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// delete book
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("book")]
|
||||
[Authorize(Policy = RMuseumSecurableItem.PDFLibraryEntityShortName + ":" + SecurableItem.DeleteOperationShortName)]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK)]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
public async Task<IActionResult> DeleteBookAsync(int id)
|
||||
{
|
||||
var res = await _pdfService.DeleteBookAsync(id);
|
||||
if (!string.IsNullOrEmpty(res.ExceptionString))
|
||||
return BadRequest(res.ExceptionString);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get authors
|
||||
/// </summary>
|
||||
@ -716,6 +663,79 @@ namespace RMuseum.Controllers
|
||||
return Ok(res.Result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// book by id
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("book/{id}")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(Book))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
|
||||
public async Task<IActionResult> GetBookByIdAsync(int id)
|
||||
{
|
||||
var res = await _pdfService.GetBookByIdAsync(id);
|
||||
if (!string.IsNullOrEmpty(res.ExceptionString))
|
||||
{
|
||||
return BadRequest(res.ExceptionString);
|
||||
}
|
||||
|
||||
return Ok(res.Result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// add a new book
|
||||
/// </summary>
|
||||
/// <param name="book"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
[HttpPost("book")]
|
||||
[Authorize(Policy = RMuseumSecurableItem.PDFLibraryEntityShortName + ":" + SecurableItem.AddOperationShortName)]
|
||||
[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>
|
||||
/// update book
|
||||
/// </summary>
|
||||
/// <param name="book"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut("book")]
|
||||
[Authorize(Policy = RMuseumSecurableItem.PDFLibraryEntityShortName + ":" + SecurableItem.ModifyOperationShortName)]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK)]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
public async Task<IActionResult> UpdateBookAsync([FromBody] Book book)
|
||||
{
|
||||
var res = await _pdfService.UpdateBookAsync(book);
|
||||
if (!string.IsNullOrEmpty(res.ExceptionString))
|
||||
return BadRequest(res.ExceptionString);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// delete book
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("book")]
|
||||
[Authorize(Policy = RMuseumSecurableItem.PDFLibraryEntityShortName + ":" + SecurableItem.DeleteOperationShortName)]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK)]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
public async Task<IActionResult> DeleteBookAsync(int id)
|
||||
{
|
||||
var res = await _pdfService.DeleteBookAsync(id);
|
||||
if (!string.IsNullOrEmpty(res.ExceptionString))
|
||||
return BadRequest(res.ExceptionString);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// add book author
|
||||
/// </summary>
|
||||
@ -814,29 +834,6 @@ namespace RMuseum.Controllers
|
||||
return Ok(res.Result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// book by id
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("book/{id}")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(Book))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
|
||||
public async Task<IActionResult> GetBookByIdAsync(int id)
|
||||
{
|
||||
var res = await _pdfService.GetBookByIdAsync(id);
|
||||
if (!string.IsNullOrEmpty(res.ExceptionString))
|
||||
{
|
||||
return BadRequest(res.ExceptionString);
|
||||
}
|
||||
|
||||
return Ok(res.Result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// get book related pdf books
|
||||
/// </summary>
|
||||
@ -844,7 +841,7 @@ namespace RMuseum.Controllers
|
||||
/// <param name="bookId"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
[HttpGet("pdfbook/by/book/{bookId}")]
|
||||
[HttpGet("book/{bookId}/pdfs")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(IEnumerable<PDFBook>))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
@ -876,6 +873,29 @@ namespace RMuseum.Controllers
|
||||
return Ok(res.Result.Books);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// volumes by id
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
[HttpGet("volumes/{id}")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(MultiVolumePDFCollection))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
|
||||
public async Task<IActionResult> GetMultiVolumePDFCollectionByIdAsync(int id)
|
||||
{
|
||||
var res = await _pdfService.GetMultiVolumePDFCollectionByIdAsync(id);
|
||||
if (!string.IsNullOrEmpty(res.ExceptionString))
|
||||
{
|
||||
return BadRequest(res.ExceptionString);
|
||||
}
|
||||
|
||||
return Ok(res.Result);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// add a new multi volume pdf collection
|
||||
/// </summary>
|
||||
|
||||
@ -2405,7 +2405,7 @@
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.PDFLibraryController.TagPDFBookAsync(System.Int32,RMuseum.Models.Artifact.RTag)">
|
||||
<summary>
|
||||
add new tag value to artifact
|
||||
add new tag value to pdf book
|
||||
</summary>
|
||||
<param name="pdfBookId"></param>
|
||||
<param name="tag">only name is processed</param>
|
||||
@ -2439,27 +2439,6 @@
|
||||
<param name="valueUrl"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.PDFLibraryController.AddBookAsync(RMuseum.Models.PDFLibrary.Book)">
|
||||
<summary>
|
||||
add a new book
|
||||
</summary>
|
||||
<param name="book"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.PDFLibraryController.UpdateBookAsync(RMuseum.Models.PDFLibrary.Book)">
|
||||
<summary>
|
||||
update book
|
||||
</summary>
|
||||
<param name="book"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.PDFLibraryController.DeleteBookAsync(System.Int32)">
|
||||
<summary>
|
||||
delete book
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.PDFLibraryController.GetAuthorsAsync(RSecurityBackend.Models.Generic.PagingParameterModel,System.String)">
|
||||
<summary>
|
||||
get authors
|
||||
@ -2520,6 +2499,34 @@
|
||||
<param name="authorId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.PDFLibraryController.GetBookByIdAsync(System.Int32)">
|
||||
<summary>
|
||||
book by id
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.PDFLibraryController.AddBookAsync(RMuseum.Models.PDFLibrary.Book)">
|
||||
<summary>
|
||||
add a new book
|
||||
</summary>
|
||||
<param name="book"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.PDFLibraryController.UpdateBookAsync(RMuseum.Models.PDFLibrary.Book)">
|
||||
<summary>
|
||||
update book
|
||||
</summary>
|
||||
<param name="book"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.PDFLibraryController.DeleteBookAsync(System.Int32)">
|
||||
<summary>
|
||||
delete book
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.PDFLibraryController.AddBookAuthorAsync(System.Int32,RMuseum.Models.PDFLibrary.AuthorRole)">
|
||||
<summary>
|
||||
add book author
|
||||
@ -2552,13 +2559,6 @@
|
||||
<param name="authorId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.PDFLibraryController.GetBookByIdAsync(System.Int32)">
|
||||
<summary>
|
||||
book by id
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.PDFLibraryController.GetBookRelatedPFFBooksAsync(RSecurityBackend.Models.Generic.PagingParameterModel,System.Int32)">
|
||||
<summary>
|
||||
get book related pdf books
|
||||
@ -2567,6 +2567,13 @@
|
||||
<param name="bookId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.PDFLibraryController.GetMultiVolumePDFCollectionByIdAsync(System.Int32)">
|
||||
<summary>
|
||||
volumes by id
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.PDFLibraryController.AddMultiVolumePDFCollectionAsync(RMuseum.Models.PDFLibrary.MultiVolumePDFCollection)">
|
||||
<summary>
|
||||
add a new multi volume pdf collection
|
||||
@ -17953,6 +17960,13 @@
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.PDFLibraryService.GetMultiVolumePDFCollectionByIdAsync(System.Int32)">
|
||||
<summary>
|
||||
get volumes by id
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.PDFLibraryService.GetVolumesPDFBooks(System.Int32)">
|
||||
<summary>
|
||||
get volumes pdf books
|
||||
@ -19010,6 +19024,13 @@
|
||||
<param name="volumeId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IPDFLibraryService.GetMultiVolumePDFCollectionByIdAsync(System.Int32)">
|
||||
<summary>
|
||||
get volumes by id
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:RMuseum.Services.IPictureFileService">
|
||||
<summary>
|
||||
manipulating picture files
|
||||
|
||||
@ -261,5 +261,12 @@ namespace RMuseum.Services
|
||||
/// <param name="volumeId"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<PDFBook[]>> GetVolumesPDFBooks(int volumeId);
|
||||
|
||||
/// <summary>
|
||||
/// get volumes by id
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<MultiVolumePDFCollection>> GetMultiVolumePDFCollectionByIdAsync(int id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1160,6 +1160,23 @@ namespace RMuseum.Services.Implementation
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get volumes by id
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<MultiVolumePDFCollection>> GetMultiVolumePDFCollectionByIdAsync(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new RServiceResult<MultiVolumePDFCollection>(await _context.MultiVolumePDFCollections.AsNoTracking().Where(x => x.Id == id).SingleOrDefaultAsync());
|
||||
}
|
||||
catch (Exception exp)
|
||||
{
|
||||
return new RServiceResult<MultiVolumePDFCollection>(null, exp.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get volumes pdf books
|
||||
/// </summary>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user