private void CreateResCondition( ICollection <ReservationConditionCreateDto> rcDtos, ICollection <ReservationCondition> rcList, Guid resManagerId) { if (rcDtos?.Count > 0) { foreach (var condition in rcDtos) { var resCondition = new ReservationCondition( GuidGenerator.Create(), condition.ItemName, condition.ItemValue, condition.RCType, resManagerId); if (condition.RCType == ReservationConditionType.Period && condition.ReservationPeriods?.Count > 0) { foreach (var period in condition.ReservationPeriods) { var rPeriod = new ReservationPeriod(GuidGenerator.Create(), period.StartTime, period.EndTime, period.Name, resCondition.Id); resCondition.AddResPeriod(rPeriod); } } if (condition.ReservationConditions?.Count > 0) { CreateResCondition(condition.ReservationConditions, resCondition.ChildResConditions, resManagerId); } rcList.Add(resCondition); } } }
public void AddResPeriod(ReservationPeriod period) { Check.NotNull(period, nameof(period)); RPeriod.Add(period); }