#405 display list of tag values
This commit is contained in:
parent
be577b6477
commit
c91e25052a
@ -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
|
||||
/// </summary>
|
||||
public virtual PDFSource PDFSource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// tags view models
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public ICollection<RArtifactTagViewModel> ArtifactTags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Binary Tagged Items
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public ICollection<RTagSum> RTagSums { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Titles of Items in Contents
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public ICollection<RTitleInContents> Contents { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -12488,6 +12488,21 @@
|
||||
PDF Source
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.PDFLibrary.PDFBook.ArtifactTags">
|
||||
<summary>
|
||||
tags view models
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.PDFLibrary.PDFBook.RTagSums">
|
||||
<summary>
|
||||
Binary Tagged Items
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.PDFLibrary.PDFBook.Contents">
|
||||
<summary>
|
||||
Titles of Items in Contents
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:RMuseum.Models.PDFLibrary.PDFPage">
|
||||
<summary>
|
||||
PDF Page
|
||||
|
||||
@ -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<RArtifactTagViewModel> rArtifactTags = new List<RArtifactTagViewModel>();
|
||||
if (pdfBook.Tags != null)
|
||||
{
|
||||
foreach (RTagValue tag in pdfBook.Tags)
|
||||
{
|
||||
RArtifactTagViewModel related = rArtifactTags.Where(t => t.Id == tag.RTagId).SingleOrDefault();
|
||||
List<RTagValue> values = (related == null) ? new List<RTagValue>() : new List<RTagValue>(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>(pdfBook);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user