Ejemplo n.º 1
0
        /// <summary>
        /// 套餐模板方案空间映射
        /// </summary>
        /// <param name="packSchemeSpace">套餐模板方案空间领域模型</param>
        /// <returns>套餐模板方案空间数据传输对象</returns>
        public static DecorationPackSchemeSpaceInfo ToDTO(this DecorationPackSchemeSpace packSchemeSpace)
        {
            DecorationPackSchemeSpaceInfo packSchemeSpaceInfo = Transform <DecorationPackSchemeSpace, DecorationPackSchemeSpaceInfo> .Map(packSchemeSpace);

            packSchemeSpaceInfo.PackSchemeInfo = packSchemeSpace.PackScheme.ToDTO(null);

            return(packSchemeSpaceInfo);
        }
        /// <summary>
        /// 删除相关套餐模板方案空间
        /// </summary>
        /// <param name="packId">套餐模板Id</param>
        /// <param name="packSpaceId">套餐模板空间Id</param>
        private void RemovePackSchemeSpaces(Guid packId, Guid packSpaceId)
        {
            IEnumerable <DecorationPackScheme> packSchemes = this._unitOfWork.ResolvePackSchemesByPack(packId);

            foreach (DecorationPackScheme packScheme in packSchemes)
            {
                DecorationPackSchemeSpace currentSchemeSpace = packScheme.GetSchemeSpace(packSpaceId);
                if (currentSchemeSpace != null)
                {
                    packScheme.RemoveSchemeSpace(currentSchemeSpace);
                }

                this._unitOfWork.RegisterSave(packScheme);
            }
        }