コード例 #1
0
        public void ModifyPower(PowerDto powerDto)
        {
            ValidateParameter.Validate(powerDto);

            var power = powerDto.ConvertToModel<PowerDto, Power>();

            var powerResult = Query.FindOne(SpecificationFactory.Create<Power>(p => p.Id == power.Id));

            if (powerResult == null)
            {
                throw new BusinessException("该权限可能已被删除,请刷新后再试");
            }

            powerResult.ModifyPowerIdentity(power.PowerIdentity);

            powerResult.ModifyPowerName(power.Name);

            Repository.Create<Power>().Update(powerResult);

            UnitOfWork.Commit();
        }
コード例 #2
0
        public void AddNewPower(PowerDto powerDto)
        {
            ValidateParameter.Validate(powerDto);

            var power = powerDto.ConvertToModel<PowerDto, Power>();

            Repository.Create<Power>().Add(power);

            UnitOfWork.Commit();
        }