/// <summary> /// Modify a Guest for the limited mobile api /// </summary> /// <param name="guest">Guest to modify</param> public void Modify(Guest guest) { // Check if the Guest is associated to at least one confirmed booking. If Yes, then Email and Phone number cannot be removed. if (guestDao.IsGuestAssociatedToConfirmedBooking(guest.Id.Value, guest.BusinessId)) { guest.IsGuestValidForConfirmedBooking(); } else { guest.IsValid(); } // Check if CountryId is specified. if not, CountryId should be defaulted to country of business. if (!guest.IsCountryIdSpecified()) { guest.CountryId = countryDao.GetByBusiness(guest.BusinessId).Id; } using (var btx = new BusinessTransaction()) { // Create Guest or throw exception for invalid Guest guestDao.Modify(guest); // Create Guest event guestEventDao.Create(new GuestEvent { GuestEventType = GuestEventType.Modified, GuestId = guest.Id.HasValue ? guest.Id.Value : 0 }); btx.Commit(); } }