includeBio parameter for poets

This commit is contained in:
Hamid Reza Mohammadi 2020-12-28 20:48:12 +03:30
parent 869c97a6a0
commit a902cf8853
4 changed files with 14 additions and 8 deletions

View File

@ -20,16 +20,17 @@ namespace RMuseum.Controllers
/// get list of poets
/// </summary>
/// <param name="websitePoets"></param>
/// <param name="includeBio"></param>
/// <returns></returns>
[HttpGet]
[Route("poets")]
[AllowAnonymous]
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(GanjoorPoetViewModel[]))]
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
public async Task<IActionResult> GetPoets(bool websitePoets = true)
public async Task<IActionResult> GetPoets(bool websitePoets = true, bool includeBio = true)
{
RServiceResult<GanjoorPoetViewModel[]> res =
await _ganjoorService.GetPoets(websitePoets);
await _ganjoorService.GetPoets(websitePoets, includeBio);
if (!string.IsNullOrEmpty(res.ExceptionString))
return BadRequest(res.ExceptionString);
return Ok(res.Result);

View File

@ -615,11 +615,12 @@
<param name="auditLogService">
</param>
</member>
<member name="M:RMuseum.Controllers.GanjoorController.GetPoets(System.Boolean)">
<member name="M:RMuseum.Controllers.GanjoorController.GetPoets(System.Boolean,System.Boolean)">
<summary>
get list of poets
</summary>
<param name="websitePoets"></param>
<param name="includeBio"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Controllers.GanjoorController.GetPoetById(System.Int32)">
@ -4656,11 +4657,12 @@
Ganjoor Poems Content Privider Service
</summary>
</member>
<member name="M:RMuseum.Services.IGanjoorService.GetPoets(System.Boolean)">
<member name="M:RMuseum.Services.IGanjoorService.GetPoets(System.Boolean,System.Boolean)">
<summary>
Get List of poets
</summary>
<param name="websitePoets"></param>
<param name="includeBio"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.IGanjoorService.GetPoetById(System.Int32)">
@ -5425,11 +5427,12 @@
IGanjoorService implementation
</summary>
</member>
<member name="M:RMuseum.Services.Implementation.GanjoorService.GetPoets(System.Boolean)">
<member name="M:RMuseum.Services.Implementation.GanjoorService.GetPoets(System.Boolean,System.Boolean)">
<summary>
Get List of poets
</summary>
<param name="websitePoets"></param>
<param name="includeBio"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.Implementation.GanjoorService.GetPoetById(System.Int32)">

View File

@ -16,8 +16,9 @@ namespace RMuseum.Services
/// Get List of poets
/// </summary>
/// <param name="websitePoets"></param>
/// <param name="includeBio"></param>
/// <returns></returns>
Task<RServiceResult<GanjoorPoetViewModel[]>> GetPoets(bool websitePoets);
Task<RServiceResult<GanjoorPoetViewModel[]>> GetPoets(bool websitePoets, bool includeBio = true);
/// <summary>
/// get poet by id

View File

@ -29,8 +29,9 @@ namespace RMuseum.Services.Implementation
/// Get List of poets
/// </summary>
/// <param name="websitePoets"></param>
/// <param name="includeBio"></param>
/// <returns></returns>
public async Task<RServiceResult<GanjoorPoetViewModel[]>> GetPoets(bool websitePoets)
public async Task<RServiceResult<GanjoorPoetViewModel[]>> GetPoets(bool websitePoets, bool includeBio = true)
{
try
{
@ -45,7 +46,7 @@ namespace RMuseum.Services.Implementation
{
Id = poet.Id,
Name = poet.Name,
Description = poet.Description,
Description = includeBio ? poet.Description : null,
FullUrl = cat.FullUrl,
RootCatId = cat.Id
}