Advertisement
Guest User

Untitled

a guest
May 15th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.89 KB | None | 0 0
  1. using System.Collections.ObjectModel;
  2. using System.Linq;
  3.  
  4. namespace WindowsFormsApplication1
  5. {
  6.     public class User
  7.     {
  8.         public string Username { get; set; }
  9.         public string Password { get; set; }
  10.  
  11.         public static Collection<User> getListOfUsers()
  12.         {
  13.             return new Collection<User>
  14.                        {
  15.                            new User{Username = "tommy", Password = "secret"},
  16.                            new User{Username = "brendan", Password = "secret"},
  17.                            new User{Username = "jack", Password = "secret"},
  18.                        };
  19.         }
  20.     }
  21.  
  22.     public static class UserHelper
  23.     {
  24.         public static bool validateLogin(this Collection<User> users, string username, string password)
  25.         {
  26.             return users.FirstOrDefault(x => x.Username == username).Password == password;
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement