#418 published parameter for GetGanjoorQuotedPoemsForPoemAsync
This commit is contained in:
parent
faf4884804
commit
1588fda0e5
@ -3697,16 +3697,17 @@ namespace RMuseum.Controllers
|
||||
/// <param name="skip"></param>
|
||||
/// <param name="itemsCount"></param>
|
||||
/// <param name="onlyClaimedByBothPoets"></param>
|
||||
/// <param name="published"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("poem/{id}/quoteds")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(GanjoorQuotedPoem[]))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
public async Task<IActionResult> GetGanjoorQuotedPoemsForPoemAsync(int id, int skip, int itemsCount, bool onlyClaimedByBothPoets = false)
|
||||
public async Task<IActionResult> GetGanjoorQuotedPoemsForPoemAsync(int id, int skip, int itemsCount, bool onlyClaimedByBothPoets = false, bool? published = true)
|
||||
{
|
||||
RServiceResult<GanjoorQuotedPoem[]> res =
|
||||
await _ganjoorService.GetGanjoorQuotedPoemsForPoemAsync(id, skip, itemsCount, onlyClaimedByBothPoets);
|
||||
await _ganjoorService.GetGanjoorQuotedPoemsForPoemAsync(id, skip, itemsCount, onlyClaimedByBothPoets, published);
|
||||
if (!string.IsNullOrEmpty(res.ExceptionString))
|
||||
return BadRequest(res.ExceptionString);
|
||||
return Ok(res.Result);
|
||||
|
||||
@ -2027,7 +2027,7 @@
|
||||
<param name="relatedPoetId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.GanjoorController.GetGanjoorQuotedPoemsForPoemAsync(System.Int32,System.Int32,System.Int32,System.Boolean)">
|
||||
<member name="M:RMuseum.Controllers.GanjoorController.GetGanjoorQuotedPoemsForPoemAsync(System.Int32,System.Int32,System.Int32,System.Boolean,System.Nullable{System.Boolean})">
|
||||
<summary>
|
||||
get quoted poems for a poem
|
||||
</summary>
|
||||
@ -2035,6 +2035,7 @@
|
||||
<param name="skip"></param>
|
||||
<param name="itemsCount"></param>
|
||||
<param name="onlyClaimedByBothPoets"></param>
|
||||
<param name="published"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.GanjoorController.GetGanjoorQuotedPoemsForRelatedAsync(System.Int32,System.Int32,System.Nullable{System.Boolean})">
|
||||
@ -15597,7 +15598,7 @@
|
||||
<param name="relatedPoetId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IGanjoorService.GetGanjoorQuotedPoemsForPoemAsync(System.Int32,System.Int32,System.Int32,System.Boolean)">
|
||||
<member name="M:RMuseum.Services.IGanjoorService.GetGanjoorQuotedPoemsForPoemAsync(System.Int32,System.Int32,System.Int32,System.Boolean,System.Nullable{System.Boolean})">
|
||||
<summary>
|
||||
get quoted poems for a poem
|
||||
</summary>
|
||||
@ -15605,6 +15606,7 @@
|
||||
<param name="skip"></param>
|
||||
<param name="itemsCount"></param>
|
||||
<param name="onlyClaimedByBothPoets"></param>
|
||||
<param name="published"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IGanjoorService.GetGanjoorQuotedPoemsForRelatedAsync(System.Int32,System.Int32,System.Nullable{System.Boolean})">
|
||||
@ -17703,7 +17705,7 @@
|
||||
<param name="indirect"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.GanjoorService.GetGanjoorQuotedPoemsForPoemAsync(System.Int32,System.Int32,System.Int32,System.Boolean)">
|
||||
<member name="M:RMuseum.Services.Implementation.GanjoorService.GetGanjoorQuotedPoemsForPoemAsync(System.Int32,System.Int32,System.Int32,System.Boolean,System.Nullable{System.Boolean})">
|
||||
<summary>
|
||||
get quoted poems for a poem
|
||||
</summary>
|
||||
@ -17711,6 +17713,7 @@
|
||||
<param name="skip"></param>
|
||||
<param name="itemsCount"></param>
|
||||
<param name="onlyClaimedByBothPoets"></param>
|
||||
<param name="published"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.GanjoorService.GetGanjoorQuotedPoemsForRelatedAsync(System.Int32,System.Int32,System.Nullable{System.Boolean})">
|
||||
|
||||
@ -1239,8 +1239,9 @@ namespace RMuseum.Services
|
||||
/// <param name="skip"></param>
|
||||
/// <param name="itemsCount"></param>
|
||||
/// <param name="onlyClaimedByBothPoets"></param>
|
||||
/// <param name="published"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<GanjoorQuotedPoem[]>> GetGanjoorQuotedPoemsForPoemAsync(int poemId, int skip, int itemsCount, bool onlyClaimedByBothPoets);
|
||||
Task<RServiceResult<GanjoorQuotedPoem[]>> GetGanjoorQuotedPoemsForPoemAsync(int poemId, int skip, int itemsCount, bool onlyClaimedByBothPoets, bool? published);
|
||||
|
||||
/// <summary>
|
||||
/// two poems quoted records
|
||||
|
||||
@ -795,16 +795,19 @@ namespace RMuseum.Services.Implementation
|
||||
/// <param name="skip"></param>
|
||||
/// <param name="itemsCount"></param>
|
||||
/// <param name="onlyClaimedByBothPoets"></param>
|
||||
/// <param name="published"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<GanjoorQuotedPoem[]>> GetGanjoorQuotedPoemsForPoemAsync(int poemId, int skip, int itemsCount, bool onlyClaimedByBothPoets)
|
||||
public async Task<RServiceResult<GanjoorQuotedPoem[]>> GetGanjoorQuotedPoemsForPoemAsync(int poemId, int skip, int itemsCount, bool onlyClaimedByBothPoets, bool? published)
|
||||
{
|
||||
try
|
||||
{
|
||||
var source =
|
||||
_context.GanjoorQuotedPoems
|
||||
.AsNoTracking()
|
||||
.Where(r => r.PoemId == poemId && r.Published && r.ChosenForMainList == true
|
||||
&& (!onlyClaimedByBothPoets || r.ClaimedByBothPoets == true))
|
||||
.Where(r => r.PoemId == poemId && r.ChosenForMainList == true
|
||||
&& (!onlyClaimedByBothPoets || r.ClaimedByBothPoets == true)
|
||||
&& (published == null || r.Published == published)
|
||||
)
|
||||
.OrderBy(r => r.SortOrder).ThenBy(r => r.CachedRelatedPoemPoetDeathYearInLHijri);
|
||||
|
||||
if (itemsCount <= 0)
|
||||
|
||||
@ -1867,7 +1867,7 @@ namespace RMuseum.Services.Implementation
|
||||
return new RServiceResult<GanjoorPoemCompleteViewModel>(null, tagsRes.ExceptionString);
|
||||
PoemGeoDateTag[] geoDateTags = tagsRes.Result;
|
||||
|
||||
var quotedRes = await GetGanjoorQuotedPoemsForPoemAsync(id, 0, 6, false);
|
||||
var quotedRes = await GetGanjoorQuotedPoemsForPoemAsync(id, 0, 6, false, true);
|
||||
if (!string.IsNullOrEmpty(quotedRes.ExceptionString))
|
||||
return new RServiceResult<GanjoorPoemCompleteViewModel>(null, quotedRes.ExceptionString);
|
||||
GanjoorQuotedPoem[] quoteds = quotedRes.Result;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user