using static System.Net.Mime.MediaTypeNames; using System.Reflection; namespace PolyclinicContracts.BindingModels { public class ReportBindingModel { public string? FileName { get; set; } public DateTime? DateFrom { get; set; } public DateTime? DateTo { get; set; } public string GetPeriodString() { string txt = ""; if (DateFrom == null && DateTo == null) { txt = "за все время"; } else if (DateFrom == null) { txt = $"по {DateTo?.ToShortDateString()}"; } else if (DateTo == null) { txt = $"с {DateFrom?.ToShortDateString()}"; } else { txt = $"с {DateFrom?.ToShortDateString()} по {DateTo?.ToShortDateString()}"; } return txt; } } }