#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.Collections.Generic;
|
||||
|
||||
@ -13,7 +14,7 @@ namespace RMuseum.Models.GanjoorAudio.ViewModels
|
||||
/// constructor
|
||||
/// </summary>
|
||||
/// <param name="src"></param>
|
||||
public PoemNarrationViewModel(PoemNarration src)
|
||||
public PoemNarrationViewModel(PoemNarration src, GanjoorPoem poem)
|
||||
{
|
||||
Id = src.Id;
|
||||
Owner = new PublicRAppUser(src.Owner);
|
||||
@ -36,6 +37,8 @@ namespace RMuseum.Models.GanjoorAudio.ViewModels
|
||||
ReviewStatus = src.ReviewStatus;
|
||||
UploadDate = src.UploadDate;
|
||||
ReviewDate = src.ReviewDate;
|
||||
PoemFullTitle = poem.FullTitle;
|
||||
PoemFullUrl = poem.FullUrl;
|
||||
List<AudioSyncStatus> lst = new List<AudioSyncStatus>();
|
||||
foreach(AudioSyncStatus status in
|
||||
new AudioSyncStatus[]
|
||||
@ -78,6 +81,16 @@ namespace RMuseum.Models.GanjoorAudio.ViewModels
|
||||
/// </summary>
|
||||
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>
|
||||
/// This determines where an audio is displayed between a list of sounds related to a specfic poem
|
||||
/// </summary>
|
||||
|
||||
@ -2046,7 +2046,7 @@
|
||||
Poem Narration view model
|
||||
</summary>
|
||||
</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>
|
||||
constructor
|
||||
</summary>
|
||||
@ -2072,6 +2072,16 @@
|
||||
Ganjoor Post Id
|
||||
</summary>
|
||||
</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">
|
||||
<summary>
|
||||
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)
|
||||
join poem in _context.GanjoorPoems
|
||||
on audio.GanjoorPostId equals poem.Id
|
||||
select new PoemNarrationViewModel(audio);
|
||||
select new PoemNarrationViewModel(audio, poem);
|
||||
|
||||
|
||||
|
||||
@ -75,12 +75,16 @@ namespace RMuseum.Services.Implementation
|
||||
{
|
||||
try
|
||||
{
|
||||
var narration = await _context.AudioFiles.Where(a => a.Id == id).SingleOrDefaultAsync();
|
||||
if(narration == null)
|
||||
{
|
||||
return new RServiceResult<PoemNarrationViewModel>(null);
|
||||
}
|
||||
return new RServiceResult<PoemNarrationViewModel>(new PoemNarrationViewModel(narration));
|
||||
var source =
|
||||
from audio in _context.AudioFiles
|
||||
.Include(a => a.Owner)
|
||||
.Where(a => a.Id == id)
|
||||
join poem in _context.GanjoorPoems
|
||||
on audio.GanjoorPostId equals poem.Id
|
||||
select new PoemNarrationViewModel(audio, poem);
|
||||
|
||||
var narration = await source.SingleOrDefaultAsync();
|
||||
return new RServiceResult<PoemNarrationViewModel>(narration);
|
||||
}
|
||||
catch (Exception exp)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user