#23 adding Poem information to narrations GET API
This commit is contained in:
parent
664c5808ec
commit
bf4e36cacc
@ -1,4 +1,5 @@
|
|||||||
using RSecurityBackend.Models.Auth.ViewModels;
|
using RMuseum.Models.Ganjoor;
|
||||||
|
using RSecurityBackend.Models.Auth.ViewModels;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
@ -13,7 +14,7 @@ namespace RMuseum.Models.GanjoorAudio.ViewModels
|
|||||||
/// constructor
|
/// constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="src"></param>
|
/// <param name="src"></param>
|
||||||
public PoemNarrationViewModel(PoemNarration src)
|
public PoemNarrationViewModel(PoemNarration src, GanjoorPoem poem)
|
||||||
{
|
{
|
||||||
Id = src.Id;
|
Id = src.Id;
|
||||||
Owner = new PublicRAppUser(src.Owner);
|
Owner = new PublicRAppUser(src.Owner);
|
||||||
@ -36,6 +37,8 @@ namespace RMuseum.Models.GanjoorAudio.ViewModels
|
|||||||
ReviewStatus = src.ReviewStatus;
|
ReviewStatus = src.ReviewStatus;
|
||||||
UploadDate = src.UploadDate;
|
UploadDate = src.UploadDate;
|
||||||
ReviewDate = src.ReviewDate;
|
ReviewDate = src.ReviewDate;
|
||||||
|
PoemFullTitle = poem.FullTitle;
|
||||||
|
PoemFullUrl = poem.FullUrl;
|
||||||
List<AudioSyncStatus> lst = new List<AudioSyncStatus>();
|
List<AudioSyncStatus> lst = new List<AudioSyncStatus>();
|
||||||
foreach(AudioSyncStatus status in
|
foreach(AudioSyncStatus status in
|
||||||
new AudioSyncStatus[]
|
new AudioSyncStatus[]
|
||||||
@ -78,6 +81,16 @@ namespace RMuseum.Models.GanjoorAudio.ViewModels
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int GanjoorPostId { get; set; }
|
public int GanjoorPostId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Poem Full Title
|
||||||
|
/// </summary>
|
||||||
|
public string PoemFullTitle { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Poem Full Url (without domain name)
|
||||||
|
/// </summary>
|
||||||
|
public string PoemFullUrl { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This determines where an audio is displayed between a list of sounds related to a specfic poem
|
/// This determines where an audio is displayed between a list of sounds related to a specfic poem
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -2046,7 +2046,7 @@
|
|||||||
Poem Narration view model
|
Poem Narration view model
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.#ctor(RMuseum.Models.GanjoorAudio.PoemNarration)">
|
<member name="M:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.#ctor(RMuseum.Models.GanjoorAudio.PoemNarration,RMuseum.Models.Ganjoor.GanjoorPoem)">
|
||||||
<summary>
|
<summary>
|
||||||
constructor
|
constructor
|
||||||
</summary>
|
</summary>
|
||||||
@ -2072,6 +2072,16 @@
|
|||||||
Ganjoor Post Id
|
Ganjoor Post Id
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.PoemFullTitle">
|
||||||
|
<summary>
|
||||||
|
Poem Full Title
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.PoemFullUrl">
|
||||||
|
<summary>
|
||||||
|
Poem Full Url (without domain name)
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.AudioOrder">
|
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.AudioOrder">
|
||||||
<summary>
|
<summary>
|
||||||
This determines where an audio is displayed between a list of sounds related to a specfic poem
|
This determines where an audio is displayed between a list of sounds related to a specfic poem
|
||||||
|
|||||||
@ -49,7 +49,7 @@ namespace RMuseum.Services.Implementation
|
|||||||
.OrderByDescending(a => a.UploadDate)
|
.OrderByDescending(a => a.UploadDate)
|
||||||
join poem in _context.GanjoorPoems
|
join poem in _context.GanjoorPoems
|
||||||
on audio.GanjoorPostId equals poem.Id
|
on audio.GanjoorPostId equals poem.Id
|
||||||
select new PoemNarrationViewModel(audio);
|
select new PoemNarrationViewModel(audio, poem);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -75,12 +75,16 @@ namespace RMuseum.Services.Implementation
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var narration = await _context.AudioFiles.Where(a => a.Id == id).SingleOrDefaultAsync();
|
var source =
|
||||||
if(narration == null)
|
from audio in _context.AudioFiles
|
||||||
{
|
.Include(a => a.Owner)
|
||||||
return new RServiceResult<PoemNarrationViewModel>(null);
|
.Where(a => a.Id == id)
|
||||||
}
|
join poem in _context.GanjoorPoems
|
||||||
return new RServiceResult<PoemNarrationViewModel>(new PoemNarrationViewModel(narration));
|
on audio.GanjoorPostId equals poem.Id
|
||||||
|
select new PoemNarrationViewModel(audio, poem);
|
||||||
|
|
||||||
|
var narration = await source.SingleOrDefaultAsync();
|
||||||
|
return new RServiceResult<PoemNarrationViewModel>(narration);
|
||||||
}
|
}
|
||||||
catch (Exception exp)
|
catch (Exception exp)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user