public static void MapFromEntity(this DateRangeRuleModel model, DateRangeRuleConfiguration rule)
 {
     model.Id        = rule.Id;
     model.EventId   = rule.EventId;
     model.EndDate   = rule.EndDate.ToString("dd.MM.yyyy");
     model.EndTime   = rule.EndTime.ToString("hh\\:mm");
     model.StartDate = rule.StartDate.ToString("dd.MM.yyyy");
     model.StartTime = rule.StartTime.ToString("hh\\:mm");
     model.Status    = rule.AvailabilityStatus;
 }
        public static void MapToEntity(this DateRangeRuleModel model, DateRangeRuleConfiguration rule)
        {
            if (model.Id.HasValue)
            {
                rule.Id = model.Id.Value;
            }

            rule.AvailabilityStatus = model.Status.Value;
            rule.EventId            = model.EventId;
            rule.EndDate            = DateTimeUtility.NullableDateTimeFor(model.EndDate);
            rule.EndTime            = DateTimeUtility.NullableTimeSpanFor(model.EndTime);
            rule.StartDate          = DateTime.Parse(model.StartDate);
            rule.StartTime          = DateTimeUtility.NullableTimeSpanFor(model.StartTime);
        }