tesses-cms/Tesses.CMS/Season.cs

40 lines
1.4 KiB
C#

using System;
using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json;
namespace Tesses.CMS
{
public class Season
{
[JsonIgnore]
public long Id {get;set;}
[JsonProperty("proper_name")]
public string ProperName {get;set;}="";
[JsonProperty("season_number")]
public int SeasonNumber {get;set;}
[JsonIgnore]
public long ShowId {get;set;}
[JsonIgnore]
public long UserId {get;set;}
[JsonProperty("creation_time")]
public DateTime CreationTime {get;set;}
[JsonProperty("last_updated_time")]
public DateTime LastUpdated {get;set;}
[JsonProperty("description")]
public string Description {get;set;}="";
public object Scriban(CMSConfiguration configuration,string dir,string user,string show)
{
return new {
Proper = System.Web.HttpUtility.HtmlEncode( ProperName),
Number = SeasonNumber,
Description = System.Web.HttpUtility.HtmlEncode(Description),
Thumbnail = File.Exists(Path.Combine(dir,user,"show",show,$"Season {SeasonNumber.ToString("D2")}","thumbnail.jpg")) ? $"{configuration.Root.TrimEnd('/')}/content/{user}/show/{show}/Season%20{SeasonNumber.ToString("D2")}/thumbnail.jpg" : $"{configuration.Root.TrimEnd('/')}/content/{user}/show/{show}/thumbnail.jpg"
};
}
}
}