示例#1
0
        public Users GetUsersDetailsByUserName(string userName)
        {
            Users users = null;

            using (var entity = new TaxProjectDB.TaxProjectDB())
            {
                var dbUser = (from u in entity.Users
                              where u.USERNAME == userName
                              select new
                {
                    u.USERNAME,
                    u.Password,
                    u.Salary
                }).SingleOrDefault();

                if (dbUser != null)
                {
                    users = new Users();
                    users.EmailAddress = dbUser.USERNAME;
                    users.Password     = dbUser.Password;
                    users.Salary       = dbUser.Salary.Value;
                }
            }
            return(users);
        }
示例#2
0
 public bool IsValidUser(string userName, string password)
 {
     using (var entity = new TaxProjectDB.TaxProjectDB())
     {
         return(entity.Users.Any(a => a.USERNAME == userName && a.Password == password));
     }
 }