Exemplo n.º 1
0
        /// <summary>
        /// 创建之前的业务验证
        /// </summary>
        private void createValidate(Message message)
        {
            var retValue = new CreateMessageRetValue();

            var brokenRules = message.GetBrokenRules().ToList();

            if (brokenRules.Count() > 0)
            {
                retValue.Set((byte)CreateMessageCode.Business, brokenRules);
                throw new BusinessRuleException().Create(retValue);
            }
        }
Exemplo n.º 2
0
        public CreateMessageRetValue CreateMessage(Message message)
        {
            //先创建一个返回值对象
            var retValue = new CreateMessageRetValue();

            //创建对象之前的业务验证
            createValidate(message);

            _messageRepository.Add(message);

            //设置成功状态
            retValue.Set((byte)CreateMessageCode.Success);

            return(retValue);
        }