/// <summary> /// Modifies rates for a particular rate plan /// </summary> /// <param name="ratePlanRate">Rate plan rate</param> /// <param name="registerEvent">if true, does event as well</param> /// <returns>Modified rate plan rate</returns> public virtual RatePlanRate ModifyRatePlanRates(RatePlanRate ratePlanRate, bool registerEvent = true) { if (ratePlanRate == null) { return null; } if (ratePlanRate.Id == default(int) || ratePlanRate.RatePlanId == default(int)) { // can't modify with bad id throw new ValidationException(ErrorFactory.CreateAndLogError(Errors.SRVEX30098, "RoomTypeManager.ModifyRatePlanRate", arguments: new object[] { ratePlanRate })); } if (ratePlanRate.IsValid()) { using (var tx = new BusinessTransaction()) { ratePlanRateDao.Modify(ratePlanRate); tx.Commit(); } if (registerEvent) { eventTrackingManager.CreateBusinessEventAsync(ratePlanRate.BusinessId, BusinessEventTypesEnum.RatePlanRateModified, ratePlanRate.Id.ToString(CultureInfo.InvariantCulture)); } } return ratePlanRate; }