#400 author crud

This commit is contained in:
Hamid Reza Mohammadi 2023-07-24 19:06:50 +03:30
parent caa10ec810
commit 9989e37027
2 changed files with 50 additions and 0 deletions

View File

@ -528,6 +528,42 @@ namespace RMuseum.Controllers
return Ok(res.Result);
}
/// <summary>
/// edit an existing author
/// </summary>
/// <param name="author"></param>
/// <returns></returns>
[HttpPut("author")]
[Authorize(Policy = RMuseumSecurableItem.PDFLibraryEntityShortName + ":" + SecurableItem.AddOperationShortName)]
[ProducesResponseType((int)HttpStatusCode.OK)]
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
public async Task<IActionResult> UpdateAuthorAsync([FromBody] Author author)
{
var res = await _pdfService.UpdateAuthorAsync(author);
if (!string.IsNullOrEmpty(res.ExceptionString))
return BadRequest(res.ExceptionString);
return Ok();
}
/// <summary>
/// delete an existing author
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpDelete("author/{id}")]
[Authorize(Policy = RMuseumSecurableItem.PDFLibraryEntityShortName + ":" + SecurableItem.AddOperationShortName)]
[ProducesResponseType((int)HttpStatusCode.OK)]
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
public async Task<IActionResult> DeleteAuthorAsync(int id)
{
var res = await _pdfService.DeleteAuthorAsync(id);
if (!string.IsNullOrEmpty(res.ExceptionString))
return BadRequest(res.ExceptionString);
return Ok();
}
/// <summary>
/// add a new mukti volume pdf collection
/// </summary>

View File

@ -2461,6 +2461,20 @@
<param name="author"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Controllers.PDFLibraryController.UpdateAuthorAsync(RMuseum.Models.PDFLibrary.Author)">
<summary>
edit an existing author
</summary>
<param name="author"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Controllers.PDFLibraryController.DeleteAuthorAsync(System.Int32)">
<summary>
delete an existing author
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Controllers.PDFLibraryController.AddMultiVolumePDFCollection(RMuseum.Models.PDFLibrary.MultiVolumePDFCollection)">
<summary>
add a new mukti volume pdf collection