Files
2026-04-27 10:50:07 -05:00

63 lines
1.5 KiB
C#

using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace LCU.Library.Internal.FileOperationsModels.Models.HtmlToPdfModels;
public class HtmlToPdfRequest
{
[Required(AllowEmptyStrings = false)]
public string HtmlTemplateFilePath { get; set; }
[Required]
[RegularExpression(@"^[^\.]+$", ErrorMessage = "File extensions are not allowed.")]
public string PdfName { get; set; }
public bool KeepHtmlFile { get; set; } = false;
public bool KeepPdfFile { get; set; } = false;
[Required(AllowEmptyStrings = false)]
public string HtmlSaveFilePath { get; set; }
[Required(AllowEmptyStrings = false)]
public string PdfSaveFilePath { get; set; }
public List<TagValue> BodyTagValues { get; set; }
public List<ValueCollection> BodyValueCollections { get; set; }
[NotMapped]
public string FinalHtmlSaveFilePath
{
get
{
var finalHtmlSavePath = HtmlSaveFilePath.EndsWith("\\") ?
HtmlSaveFilePath :
$"{HtmlSaveFilePath}\\";
return finalHtmlSavePath;
}
}
[NotMapped]
public string FinalPdfSaveFilePath
{
get
{
var finalPdfSaveFilePath = PdfSaveFilePath.EndsWith("\\") ?
PdfSaveFilePath :
$"{PdfSaveFilePath}\\";
return finalPdfSaveFilePath;
}
}
[NotMapped]
public string FinalHtmlSaveFilePathWithFile
{
get
{
return $"{FinalHtmlSaveFilePath}{PdfName}.html";
}
}
[NotMapped]
public string FinalPdfSaveFilePathWithFile
{
get
{
return $"{FinalPdfSaveFilePath}{PdfName}.pdf";
}
}
}