diff --git a/RMuseum/Models/Ganjoor/ViewModels/GanjoorPoemCompleteViewModel.cs b/RMuseum/Models/Ganjoor/ViewModels/GanjoorPoemCompleteViewModel.cs index ef9a4c3c..800e4fd0 100644 --- a/RMuseum/Models/Ganjoor/ViewModels/GanjoorPoemCompleteViewModel.cs +++ b/RMuseum/Models/Ganjoor/ViewModels/GanjoorPoemCompleteViewModel.cs @@ -9,9 +9,44 @@ namespace RMuseum.Models.Ganjoor.ViewModels public class GanjoorPoemCompleteViewModel { /// - /// basic poem info + /// Id /// - public GanjoorPoem Poem { get; set; } + public int Id { get; set; } + + /// + /// title + /// + public string Title { get; set; } + + /// + /// cat + parent cats title + title + /// + public string FullTitle { get; set; } + + /// + /// url => slug + /// + public string UrlSlug { get; set; } + + /// + /// sample: /hafez/ghazal/sh1 + /// + public string FullUrl { get; set; } + + /// + /// verses text + /// + public string PlainText { get; set; } + + /// + /// verses text as html (ganjoor.net format) + /// + public string HtmlText { get; set; } + + /// + /// category + /// + public GanjoorPoetCompleteViewModel Category { get; set; } /// /// Recitations diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml index 95a3c889..6bec737f 100644 --- a/RMuseum/RMuseum.xml +++ b/RMuseum/RMuseum.xml @@ -3470,9 +3470,44 @@ a more complete GanjoorPoem View Model - + - basic poem info + Id + + + + + title + + + + + cat + parent cats title + title + + + + + url => slug + + + + + sample: /hafez/ghazal/sh1 + + + + + verses text + + + + + verses text as html (ganjoor.net format) + + + + + category diff --git a/RMuseum/Services/Implementation/GanjoorService.cs b/RMuseum/Services/Implementation/GanjoorService.cs index 7562e8b5..76dfc466 100644 --- a/RMuseum/Services/Implementation/GanjoorService.cs +++ b/RMuseum/Services/Implementation/GanjoorService.cs @@ -301,7 +301,7 @@ namespace RMuseum.Services.Implementation try { int poemId = _GetRandomPoemId(); - var poem = (await GetPoemById(poemId)).Result; + var poem = await _context.GanjoorPoems.Where(p => p.Id == poemId).SingleOrDefaultAsync(); PublicRecitationViewModel[] recitations = poem == null ? new PublicRecitationViewModel[] { } : (await GetPoemRecitations(poemId)).Result; int loopPreventer = 0; while (poem == null || recitations.Length == 0) @@ -317,7 +317,14 @@ namespace RMuseum.Services.Implementation ( new GanjoorPoemCompleteViewModel() { - Poem = poem, + Id = poem.Id, + Title = poem.Title, + FullTitle = poem.FullTitle, + FullUrl = poem.FullUrl, + UrlSlug = poem.UrlSlug, + HtmlText = poem.HtmlText, + PlainText = poem.PlainText, + Category = null,//no usage for now, so do not waste resources Recitations = recitations, Images = null //no usage for now, so do not waste resources }