예제 #1
0
        public static void MapTo(this PartialCompletionDate partialCompletionDate, IHavePartialCompletionDateEntity entity)
        {
            if (partialCompletionDate == null)
            {
                entity.endDate      = null;
                entity.endDateParts = null;
                entity.isCurrent    = false;
                return;
            }

            DateTime? endDate;
            DateParts?endDateParts;

            partialCompletionDate.End.MapTo(out endDate, out endDateParts);

            // 1st possibility, no end date so is current.

            if (endDate == null)
            {
                entity.endDate      = null;
                entity.endDateParts = null;
                entity.isCurrent    = true;
                return;
            }

            // 2nd possibility, end date.

            entity.endDate      = endDate;
            entity.endDateParts = (byte?)endDateParts;
            entity.isCurrent    = false;
        }
예제 #2
0
 private static School CreateSchool(int index, PartialCompletionDate completionDate)
 {
     return(new School
     {
         Id = Guid.NewGuid(),
         City = string.Format(CityFormat, index),
         Degree = string.Format(DegreeFormat, index),
         Description = string.Format(DescriptionFormat, index),
         Institution = string.Format(InstitutionFormat, index),
         Major = string.Format(MajorFormat, index),
         CompletionDate = completionDate,
     });
 }