public static void MapFromEntity(this WeeklyRuleModel model, WeeklyRuleConfiguration rule)
 {
     model.Id        = rule.Id;
     model.Status    = rule.AvailabilityStatus;
     model.Day       = rule.DayOfWeek;
     model.StartDate = rule.StartDate.ToString("dd.MM.yyyy");
     model.Time      = rule.Time.ToString("hh\\:mm");
     model.EndTime   = rule.EndTime.ToString("hh\\:mm");
     model.EventIds  = rule.EventIds.Select(i => i.ToString()).ToArray();
 }
        public static void MapToEntity(this WeeklyRuleModel model, WeeklyRuleConfiguration rule)
        {
            if (model.Id.HasValue)
            {
                rule.Id = model.Id.Value;
            }

            rule.AvailabilityStatus = model.Status.Value;
            rule.DayOfWeek          = model.Day.Value;
            rule.StartDate          = DateTimeUtility.NullableDateTimeFor(model.StartDate);
            rule.Time     = DateTimeUtility.NullableTimeSpanFor(model.Time);
            rule.EndTime  = DateTimeUtility.NullableTimeSpanFor(model.EndTime);
            rule.EventIds = model.EventIds?.Select(i => int.Parse(i)).ToList();
        }