Beispiel #1
0
        /// <summary>
        /// 登录验证
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="userPwd"></param>
        /// <returns></returns>
        public bool Login(string userName, string userPwd)
        {
            var useraccount = _Db.User.AsNoTracking().Where(w => w.UserID.Trim() == userName.Trim()).FirstOrDefault();;
            var pwd         = SecurityHelper.Encrypt(userPwd);

            if (pwd.Trim() == useraccount.PWD.Trim())
            {
                return(true);
            }
            else
            {
                return(false);
            }
            //密码得加密啊
            // return userName == "admin" && userPwd == "123456";
        }
Beispiel #2
0
        /// <summary>
        /// 添加账号
        /// </summary>
        public ResponseModel AddUser(User banner)
        {
            //var ba = new Banner { AddTime = DateTime.Now, Image = banner.Image, Url = banner.Url, Remark = banner.Remark };
            banner.PWD = SecurityHelper.Encrypt(banner.PWD);
            _Db.User.Add(banner);
            int i = _Db.SaveChanges();

            if (i > 0)
            {
                return new ResponseModel {
                           Code = 200, Status = "AddUser添加成功"
                }
            }
            ;
            return(new ResponseModel {
                Code = 0, Status = "AddUser添加失败"
            });
        }