diff --git a/RMuseum/Models/PDFLibrary/PDFBook.cs b/RMuseum/Models/PDFLibrary/PDFBook.cs index 6bb5e1c7..1bcddf88 100644 --- a/RMuseum/Models/PDFLibrary/PDFBook.cs +++ b/RMuseum/Models/PDFLibrary/PDFBook.cs @@ -1,7 +1,9 @@ using RMuseum.Models.Artifact; +using RMuseum.Models.Artifact.ViewModels; using RSecurityBackend.Models.Image; using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; namespace RMuseum.Models.PDFLibrary { @@ -214,5 +216,23 @@ namespace RMuseum.Models.PDFLibrary /// PDF Source /// public virtual PDFSource PDFSource { get; set; } + + /// + /// tags view models + /// + [NotMapped] + public ICollection ArtifactTags { get; set; } + + /// + /// Binary Tagged Items + /// + [NotMapped] + public ICollection RTagSums { get; set; } + + /// + /// Titles of Items in Contents + /// + [NotMapped] + public ICollection Contents { get; set; } } } diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml index 89effdb5..6e1393b2 100644 --- a/RMuseum/RMuseum.xml +++ b/RMuseum/RMuseum.xml @@ -12488,6 +12488,21 @@ PDF Source + + + tags view models + + + + + Binary Tagged Items + + + + + Titles of Items in Contents + + PDF Page diff --git a/RMuseum/Services/Implementation/PDFLibraryService.cs b/RMuseum/Services/Implementation/PDFLibraryService.cs index 33776756..2e13c68f 100644 --- a/RMuseum/Services/Implementation/PDFLibraryService.cs +++ b/RMuseum/Services/Implementation/PDFLibraryService.cs @@ -2,6 +2,7 @@ using Microsoft.Extensions.Configuration; using RMuseum.DbContext; using RMuseum.Models.Artifact; +using RMuseum.Models.Artifact.ViewModels; using RMuseum.Models.PDFLibrary; using RMuseum.Models.PDFLibrary.ViewModels; using RSecurityBackend.Models.Generic; @@ -55,7 +56,7 @@ namespace RMuseum.Services.Implementation .Include(b => b.Pages) .Where(b => statusArray.Contains(b.Status) && b.Id == id) .SingleOrDefaultAsync(); - if(pdfBook != null) + if (pdfBook != null) { if(pdfBook.Book != null) { @@ -72,6 +73,40 @@ namespace RMuseum.Services.Implementation .OrderBy(t => t.VolumeOrder) .ToArrayAsync(); } + List rArtifactTags = new List(); + if (pdfBook.Tags != null) + { + foreach (RTagValue tag in pdfBook.Tags) + { + RArtifactTagViewModel related = rArtifactTags.Where(t => t.Id == tag.RTagId).SingleOrDefault(); + List values = (related == null) ? new List() : new List(related.Values); + if (related == null) + { + related = + new RArtifactTagViewModel() + { + Id = tag.RTag.Id, + Order = tag.RTag.Order, + TagType = tag.RTag.TagType, + FriendlyUrl = tag.RTag.FriendlyUrl, + Status = tag.RTag.Status, + Name = tag.RTag.Name, + NameInEnglish = tag.RTag.NameInEnglish, + GlobalValue = tag.RTag.GlobalValue, + PluralName = tag.RTag.PluralName, + PluralNameInEnglish = tag.RTag.PluralNameInEnglish + }; + rArtifactTags.Add(related); + + } + values.Add(tag); + values.Sort((a, b) => a.Order - b.Order); + related.Values = values; + } + + rArtifactTags.Sort((a, b) => a.Order - b.Order); + } + pdfBook.ArtifactTags = rArtifactTags; } return new RServiceResult(pdfBook);