public int Save(MobileCodeAggregateRoot root)
        {
            if (root == null)
            {
                return(0);
            }

            return(this.daoBuilder.Build().ToEasyXmlDao(root).Insert <int>("insertMobileCodeRoot"));
        }
        public ICommandHandlerResult Execute(ICommandContext context, CreateMobileCodeCommand command)
        {
            var root = context.GetAggregateRoot(command.AggregateId, () => MobileCodeAggregateRoot.Register(context, command));

            if (!root.CanCommit())
            {
                return(context.CreateResult(CommandHandlerStatus.NothingChanged));
            }

            if (this.repository.Save(root) <= 0)
            {
                throw new RepositoryExcutingException("获取验证码失败,请稍后再尝试");
            }

            return(context.CreateResult(CommandHandlerStatus.Success));
        }
 public int Destroy(MobileCodeAggregateRoot root)
 {
     return(this.daoBuilder.Build().ToEasyXmlDao(root).Update("updateMobileCodeUsed"));
 }