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

            return(this.daoBuilder.Build().ToEasyXmlDao(root).Insert <int>("insertEmailCodeRoot"));
        }
Example #2
0
        public ICommandHandlerResult Execute(ICommandContext context, CreateEmailCodeCommand command)
        {
            var root = context.GetAggregateRoot(command.AggregateId, () => EmailCodeAggregateRoot.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(EmailCodeAggregateRoot root)
 {
     return(this.daoBuilder.Build().ToEasyXmlDao(root).Update("updateEmailCodeUsed"));
 }