public static void Validate(BookingSource bookingSource) { if (null == bookingSource) { throw new ArgumentNullException(nameof(bookingSource), "Booking data not present."); } bookingSource.ValidateDetails(); bookingSource.ValidateCabins(); bookingSource.ValidateProducts(); }
public static void ValidateCabins(BookingSource bookingSource) { if (null == bookingSource) { throw new ArgumentNullException(nameof(bookingSource), "Booking data not present."); } if (null == bookingSource.SubCruise) { throw new BookingException("Sub-cruise must be set."); } bookingSource.ValidateCabins(); }
public static Booking FromSource(BookingSource source, Guid cruiseId, string reference) { // Note that some fields are intentionally not set return(new Booking { CruiseId = cruiseId, Reference = reference, FirstName = source.FirstName, LastName = source.LastName, Email = source.Email, PhoneNo = source.PhoneNo, Lunch = source.Lunch, InternalNotes = source.InternalNotes, SubCruise = SubCruiseCode.FromString(source.SubCruise) }); }