public bool LoginCheck() { UserService service = new UserService(); List <UserModel> users = service.GetByUsername(Username).Select(u => u.ToASP()).ToList(); if (users.Count > 0) { foreach (UserModel u in users) { if (u.PwdHash == HashService.GetCrypt(Password)) { UserSession.User = new SessionUser(u.UserId, u.Username); return(true); } } } return(false); }