Esempio n. 1
0
        public bool IsValid(string _username, string _password)
        {
            ResistanceDBContext _db = new ResistanceDBContext();
            var userEntity = _db.User.ToList();
            UserModel matchUser = userEntity.Find(x => (x.UserName == _username) && (x.Password == _password));
            if (matchUser != null && matchUser.Name != null)
            {
                return true;

            }
            else {
                return false;
            }
        }
Esempio n. 2
0
 public UserModel(string UserName)
 {
     ResistanceDBContext _db = new ResistanceDBContext();
     var userEntity = _db.User.ToList();
     UserModel temp = userEntity.Find(x => (x.UserName == UserName));
     if (temp != null)
     {
         this.UserId = temp.UserId;
         this.Name = temp.Name;
         this.Password = temp.Password;
         this.UserName = temp.UserName;
         this.SavedMessages = temp.SavedMessages;
     }
 }