public IEnumerable <UserAccountModel> CheckAccountLogin(string Name, string Password) { UserAccountModel userAccount = new UserAccountModel(); List <UserAccountModel> userAccounts = userAccount.CheckAccountLogin(Name, Password).ToList(); if (userAccounts.Count == 0) { yield return(null); } else { foreach (var item in userAccounts) { yield return(item); } } }