public static User ValidateLogin(string username, string cryptPass) { DbContext context = new ApiContext(); EFRepository repo = new EFRepository(context); User dbUser = repo.GetUserByUsername(username); if (dbUser == null || dbUser.Password != cryptPass) { throw new ArgumentException(String.Format("Invalid Username or Password!")); } return dbUser; }