I have task to make AbsenceDTO with two properties DateFrom and DateTO where the Domain Absence can be a single day with three properties Day, Month and Year. Bellow is the code sample:
public class Absence
{
#region Properties
/// <summary>
/// A unique id
/// </summary>
public int Id { get; set; }
/// <summary>
/// Day of the absence
/// </summary>
public int Day { get; set; }
/// <summary>
/// Month of the absence
/// </summary>
public int Month { get; set; }
/// <summary>
/// Year of the absence
/// </summary>
public int Year { get; set; }
}
public class AbsenceDTO
{
private List<Absence> absences = null;
public AbsenceDTO()
{
}
public AbsenceDTO(List<Absence> absences)
{
this.absences = absences;
}
public DateTime DateFrom
{
get
{
return //TO DO
}
}
public DateTime DateTO
{
get
{
return //TO DO
}
}
}
So here how should I calculate DTO Date properties and what should be the best pattern/practice in making mapper/converter?