#400 get author by id

This commit is contained in:
Hamid Reza Mohammadi 2023-07-24 19:09:40 +03:30
parent 9989e37027
commit 6ee19b8eca
2 changed files with 33 additions and 0 deletions

View File

@ -510,6 +510,32 @@ namespace RMuseum.Controllers
return Ok(authorsRes.Result.Authors);
}
/// <summary>
/// get author by id
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet("author/{id}")]
[AllowAnonymous]
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(Author))]
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
public async Task<IActionResult> GetAuthorByIdAsync(int id)
{
var authorsRes = await _pdfService.GetAuthorByIdAsync(id);
if (!string.IsNullOrEmpty(authorsRes.ExceptionString))
{
return BadRequest(authorsRes.ExceptionString);
}
if(authorsRes.Result == null)
{
return NotFound();
}
return Ok(authorsRes.Result);
}
/// <summary>
/// add a new author
/// </summary>

View File

@ -2454,6 +2454,13 @@
<param name="authorName"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Controllers.PDFLibraryController.GetAuthorByIdAsync(System.Int32)">
<summary>
get author by id
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Controllers.PDFLibraryController.AddAuthorAsync(RMuseum.Models.PDFLibrary.Author)">
<summary>
add a new author