/// <summary> /// 删除套餐选区 /// </summary> /// <param name="choiceArea"></param> public void DeleteChoiceArea(BalePackChoiceArea choiceArea) { #region 最后一个选区删除验证 //if (this.ChoiceAreas.Count == 1) //{ // throw new InvalidOperationException("套餐必须存在一个选区,请重新操作!"); //} #endregion this.ChoiceAreas.Remove(choiceArea); }
/// <summary> /// 获取套餐内选区 /// </summary> /// <param name="choiceAreaId">选区Id</param> /// <returns>选区</returns> public BalePackChoiceArea GetChoiceAreaById(Guid choiceAreaId) { BalePackChoiceArea choiceArea = this.ChoiceAreas.SingleOrDefault(s => s.Id == choiceAreaId); #region # 验证 if (choiceArea == null) { throw new ArgumentOutOfRangeException("choiceAreaId", string.Format("Id为\"{0}\"的套餐选区不存在!", choiceAreaId)); } #endregion return(choiceArea); }
/// <summary> /// 新增套餐选区 /// </summary> /// <param name="choiceArea"></param> public void AddChoiceArea(BalePackChoiceArea choiceArea) { this.ChoiceAreas.Add(choiceArea); }