public DT_AuthenticateEntity GetUser(string userName, string password) { using (Team.Rehab.DataModel.RehabEntities rehab = new RehabEntities()) { // string encodedpassword = decode(password); password = Encryption.AESEncryptString(password, "", ""); //password = Encryption.AesDecryptString(password, "", ""); DT_AuthenticateEntity DTpatients = (from user in rehab.tblUsers.Where(a => a.UserId == userName && a.UserPassword == password) join usergrp in rehab.tblUserGroups on user.UserGroup equals usergrp.UGrowid select new DT_AuthenticateEntity { FirstName = user.FirstName, LastName = user.LastName, UserID = user.UserId, Role = usergrp.UserGroup //PhoneNumber = therapist.LastName, //Email = therapist.LastName } ).Distinct().ToList().FirstOrDefault(); return(DTpatients); //if (DTpatients != null) //{ // return DTpatients; //} //else //{ // throw new UnauthorizedAccessException(); //} } }