using System.ComponentModel.DataAnnotations; namespace LCU.Library.Internal.FileOperationsModels.Models { public class ParsePdfRequest { private string rootPath; private string parsedPdfname; [Required(AllowEmptyStrings = false)] public string RootPath { get { return rootPath; } set { rootPath = string.IsNullOrWhiteSpace(value) || value.EndsWith("\\") ? value : $"{value}\\"; } } [Required(AllowEmptyStrings = false)] public string PdfName { get; set; } [Required] [Range(1, int.MaxValue, ErrorMessage = "PageStart must be larger then 0.")] public int PageStart { get; set; } [Required] [Range(1, int.MaxValue, ErrorMessage = "PageStop must be larger then 0.")] public int PageStop { get; set; } public string ParsedPdfname { get { return parsedPdfname; } set { parsedPdfname = value.ToLower().EndsWith(".pdf") || string.IsNullOrWhiteSpace(value) ? value : $"{value}.pdf"; } } } }