From 6d5cb93742b9a8ae5612c2010850146fba571ed7 Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Thu, 17 Dec 2020 17:13:31 +0330 Subject: [PATCH] #48 more image information for poem --- .../GanjoorPoemCompleteViewModel.cs | 24 +++++++++++++++++++ RMuseum/RMuseum.xml | 15 ++++++++++++ .../Services/Implementation/GanjoorService.cs | 6 ++--- 3 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 RMuseum/Models/Ganjoor/ViewModels/GanjoorPoemCompleteViewModel.cs diff --git a/RMuseum/Models/Ganjoor/ViewModels/GanjoorPoemCompleteViewModel.cs b/RMuseum/Models/Ganjoor/ViewModels/GanjoorPoemCompleteViewModel.cs new file mode 100644 index 00000000..3c50ef03 --- /dev/null +++ b/RMuseum/Models/Ganjoor/ViewModels/GanjoorPoemCompleteViewModel.cs @@ -0,0 +1,24 @@ +using RMuseum.Models.GanjoorAudio.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace RMuseum.Models.Ganjoor.ViewModels +{ + /// + /// a more complete GanjoorPoem View Model + /// + public class GanjoorPoemCompleteViewModel + { + /// + /// basic poem info + /// + public GanjoorPoem Poem { get; set; } + + /// + /// Recitations + /// + public PublicRecitationViewModel[] Recitations { get; set; } + } +} diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml index 0822084e..39b2bb17 100644 --- a/RMuseum/RMuseum.xml +++ b/RMuseum/RMuseum.xml @@ -3403,6 +3403,21 @@ Non-poem paragraph + + + a more complete GanjoorPoem View Model + + + + + basic poem info + + + + + Recitations + + Import Job diff --git a/RMuseum/Services/Implementation/GanjoorService.cs b/RMuseum/Services/Implementation/GanjoorService.cs index a5aadff4..b9a9e325 100644 --- a/RMuseum/Services/Implementation/GanjoorService.cs +++ b/RMuseum/Services/Implementation/GanjoorService.cs @@ -105,7 +105,7 @@ namespace RMuseum.Services.Implementation try { var source = - from link in _context.GanjoorLinks.Include(l => l.Item).ThenInclude(i => i.Images) + from link in _context.GanjoorLinks.Include(l => l.Artifact).Include(l => l.Item).ThenInclude(i => i.Images) join poem in _context.GanjoorPoems on link.GanjoorPostId equals poem.Id where @@ -119,8 +119,8 @@ namespace RMuseum.Services.Implementation GanjoorPostId = link.GanjoorPostId, GanjoorUrl = $"https://ganjoor.net{poem.FullUrl}", GanjoorTitle = poem.FullTitle, - EntityName = "", //intentional - EntityFriendlyUrl = "", //intentional + EntityName = $"{link.Artifact.Name} » {link.Item.Name}", + EntityFriendlyUrl = $"https://museum.ganjoor.net/items/{link.Artifact.FriendlyUrl}/{link.Item.FriendlyUrl}", EntityImageId = link.Item.Images.First().Id,//the most important data field, image url is https://ganjgah.ir/api/images/thumb/{EntityImageId}.jpg ReviewResult = link.ReviewResult, Synchronized = link.Synchronized,