diff --git a/RMuseum/Controllers/GanjoorController.cs b/RMuseum/Controllers/GanjoorController.cs index a3eeada4..df93faee 100644 --- a/RMuseum/Controllers/GanjoorController.cs +++ b/RMuseum/Controllers/GanjoorController.cs @@ -2423,6 +2423,7 @@ namespace RMuseum.Controllers /// /// /// + /// /// return value is not complete or valid for some parts, you should use only the valid parts! [HttpGet] @@ -2431,9 +2432,9 @@ namespace RMuseum.Controllers [ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(IEnumerable))] [ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))] - public async Task GetSimilarPoemsAsync([FromQuery] PagingParameterModel paging, string metre, string rhyme, int poetId = 0, int catId = 0, string language = "fa-IR", GanjoorPoemFormat format = GanjoorPoemFormat.Unknown, string term = null, int coupletCountsFrom = 0, int coupletCountsTo = 0) + public async Task GetSimilarPoemsAsync([FromQuery] PagingParameterModel paging, string metre, string rhyme, int poetId = 0, int catId = 0, string language = "fa-IR", GanjoorPoemFormat format = GanjoorPoemFormat.Unknown, string term = null, int coupletCountsFrom = 0, int coupletCountsTo = 0, int[] e = null) { - var pagedResult = await _ganjoorService.GetSimilarPoemsAsync(paging, metre, rhyme, poetId == 0 ? null : poetId, catId == 0 ? null : catId, language, format, term, coupletCountsFrom, coupletCountsTo); + var pagedResult = await _ganjoorService.GetSimilarPoemsAsync(paging, metre, rhyme, poetId == 0 ? null : poetId, catId == 0 ? null : catId, language, format, term, coupletCountsFrom, coupletCountsTo, e == null ? [] : e); if (!string.IsNullOrEmpty(pagedResult.ExceptionString)) return BadRequest(pagedResult.ExceptionString); diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml index 0e525420..bafc2548 100644 --- a/RMuseum/RMuseum.xml +++ b/RMuseum/RMuseum.xml @@ -1672,7 +1672,7 @@ - + Get Similar Poems accroding to prosody and rhyme informations @@ -1686,6 +1686,7 @@ + return value is not complete or valid for some parts, you should use only the valid parts! @@ -16448,7 +16449,7 @@ - + Get Similar Poems accroding to prosody and rhyme informations @@ -16462,6 +16463,7 @@ + @@ -20565,7 +20567,7 @@ - + Get Similar Poems accroding to prosody and rhyme informations @@ -20579,6 +20581,7 @@ + diff --git a/RMuseum/Services/IGanjoorService.cs b/RMuseum/Services/IGanjoorService.cs index f280798e..44a0b976 100644 --- a/RMuseum/Services/IGanjoorService.cs +++ b/RMuseum/Services/IGanjoorService.cs @@ -495,8 +495,9 @@ namespace RMuseum.Services /// /// /// + /// /// - Task> GetSimilarPoemsAsync(PagingParameterModel paging, string metre, string rhyme, int? poetId, int? catId, string language = "fa-IR", GanjoorPoemFormat format = GanjoorPoemFormat.Unknown, string term = null, int coupletCountsFrom = 0, int coupletCountsTo = 0); + Task> GetSimilarPoemsAsync(PagingParameterModel paging, string metre, string rhyme, int? poetId, int? catId, string language, GanjoorPoemFormat format , string term , int coupletCountsFrom , int coupletCountsTo , int[] exceptPoetId ); /// /// language tagged poem sections diff --git a/RMuseum/Services/Implementation/GanjoorService.cs b/RMuseum/Services/Implementation/GanjoorService.cs index d7244c81..8e07d679 100644 --- a/RMuseum/Services/Implementation/GanjoorService.cs +++ b/RMuseum/Services/Implementation/GanjoorService.cs @@ -2543,8 +2543,9 @@ namespace RMuseum.Services.Implementation /// /// /// + /// /// - public async Task> GetSimilarPoemsAsync(PagingParameterModel paging, string metre, string rhyme, int? poetId, int? catId, string language = "fa-IR", GanjoorPoemFormat format = GanjoorPoemFormat.Unknown, string term = null, int coupletCountsFrom = 0, int coupletCountsTo = 0) + public async Task> GetSimilarPoemsAsync(PagingParameterModel paging, string metre, string rhyme, int? poetId, int? catId, string language, GanjoorPoemFormat format , string term , int coupletCountsFrom, int coupletCountsTo, int[] exceptPoetId) { if (poetId == null) { @@ -2583,6 +2584,8 @@ namespace RMuseum.Services.Implementation .Where(s => (poetId == null || s.PoetId == poetId) && + (exceptPoetId.Length == 0 || !exceptPoetId.Contains(s.PoetId ?? 0)) + && ((language == "fa-IR" && string.IsNullOrEmpty(s.Language)) || s.Language == language) && (string.IsNullOrEmpty(metre) || (metre == "null" && s.GanjoorMetreId == null) || (!string.IsNullOrEmpty(metre) && s.GanjoorMetre.Rhythm == metre))