示例#1
0
        public static void Registration(RegistrUserModel user)
        {
            Entities db    = new Entities();
            Users    users = new Users()
            {
                FIO = user.FIO, LogIn = user.LogIn, Password = Encript.Encrypt(user.Password), Role_id = int.Parse(user.Role)
            };

            db.Users.Add(users);
            db.SaveChanges();
            _FIO      = users.FIO;
            _password = users.Password;
            _role     = GetRole(int.Parse(user.Role));
            _status   = true;
        }
示例#2
0
        private static bool UserVerification()
        {
            string   cipherPass = Encript.Encrypt(_password);
            Entities db         = new Entities();
            Users    users      = db.Users.Where(n => n.LogIn == _logIn).FirstOrDefault();

            if (users != null)
            {
                if (users.Password == cipherPass)
                {
                    _FIO    = users.FIO;
                    _status = true;
                    _role   = GetRole((int)users.Role_id);
                    return(true);
                }
            }
            return(false);
        }