diff --git a/RMuseum/Models/GanjoorAudio/ViewModels/PoemNarrationViewModel.cs b/RMuseum/Models/GanjoorAudio/ViewModels/PoemNarrationViewModel.cs index 40d6288e..04ef98c1 100644 --- a/RMuseum/Models/GanjoorAudio/ViewModels/PoemNarrationViewModel.cs +++ b/RMuseum/Models/GanjoorAudio/ViewModels/PoemNarrationViewModel.cs @@ -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 /// /// - 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 lst = new List(); foreach(AudioSyncStatus status in new AudioSyncStatus[] @@ -78,6 +81,16 @@ namespace RMuseum.Models.GanjoorAudio.ViewModels /// public int GanjoorPostId { get; set; } + /// + /// Poem Full Title + /// + public string PoemFullTitle { get; set; } + + /// + /// Poem Full Url (without domain name) + /// + public string PoemFullUrl { get; set; } + /// /// This determines where an audio is displayed between a list of sounds related to a specfic poem /// diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml index 4b6c648a..caef09d9 100644 --- a/RMuseum/RMuseum.xml +++ b/RMuseum/RMuseum.xml @@ -2046,7 +2046,7 @@ Poem Narration view model - + constructor @@ -2072,6 +2072,16 @@ Ganjoor Post Id + + + Poem Full Title + + + + + Poem Full Url (without domain name) + + This determines where an audio is displayed between a list of sounds related to a specfic poem diff --git a/RMuseum/Services/Implementation/AudioNarrationService.cs b/RMuseum/Services/Implementation/AudioNarrationService.cs index 50cd21b7..e1b47de0 100644 --- a/RMuseum/Services/Implementation/AudioNarrationService.cs +++ b/RMuseum/Services/Implementation/AudioNarrationService.cs @@ -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(null); - } - return new RServiceResult(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(narration); } catch (Exception exp) {