private void Verify(AdministratorAddDto model)
        {
            AdminVerify(model, "Verify");
            //if (_user.UserType == Common.UserTypeEnum.UserInfo)
            //    Exception("Verify.UserType", "无法进行此操作");

            //if (model == null)
            //    Exception("Verify.model", "参数不能为空");

            if (string.IsNullOrEmpty(model.AdminName))
            {
                Exception("Verify.UserName", "管理员名称不能为空");
            }
        }
        public bool Insert(AdministratorAddDto model)
        {
            Verify(model);

            if (string.IsNullOrEmpty(model.AdminPwdText))
            {
                Exception("Insert.UserPwdText", "密码不能为空");
            }

            var info      = model.Clone <AdministratorDto>();
            var nameModel = _administratorDal.GetByName(info.AdminName);

            if (nameModel != null)
            {
                Exception("Insert.UserName", "用户名已存在");
            }

            info.CreateTime    = DateTime.Now;
            info.LastLoginTime = DateTime.Now;
            info.AdminPwd      = Tools.EncryptDESByAdminPwd(info.AdminPwdText);
            return(_administratorDal.Insert(info) > 0);
        }
 public ResponseResult <bool> Add([FromBody] AdministratorAddDto model)
 {
     return(_administratorService.Insert(model).Success());
 }