using System; using System.Collections.Generic; using System.Linq; using Newtonsoft.Json; using Newtonsoft.Json.Converters; namespace Sony.Filtr.Contracts.ViewModels { public class StatisticsExportViewModel where T: StatisticValue { public StatisticsExportViewModel() { Items = new List(); } public DateFiltering Filtering { get; set; } public List Items { get; set; } } public class DateFiltering { public DateTime? StartDate { get; set; } public DateTime? EndDate { get; set; } } public class StatisticValue { [JsonConverter(typeof(OnlyDateConverter))] public DateTime Date => Timestamp; public DateTime Timestamp { get; set; } } public class OnlyDateConverter : IsoDateTimeConverter { public OnlyDateConverter() { DateTimeFormat = "yyyy-MM-dd"; } } }