public object ConvertUserDetailsToClass() { Constructors.StudentAccount newStudentAccount = new Constructors.StudentAccount(); StudentAccountList = new List<Constructors.StudentAccount>(new Collections().getStudentAccounts()); StudentAccountList.ForEach(sa => { if (sa.Firstname == Validator.Finalize(txtFirstName.Text) && sa.Lastname == Validator.Finalize(txtLastName.Text) && sa.Password == Validator.Finalize(txtPassword.Text)) { newStudentAccount.Firstname = sa.Firstname; newStudentAccount.Lastname = sa.Lastname; newStudentAccount.EmailAddress = sa.EmailAddress; newStudentAccount.StudentID = sa.StudentID; return; } }); return newStudentAccount; }
List<Constructors.StudentAccount> StudentAccountList; // = new List<Constructors.StudentAccount>(new Collections().getStudentAccounts()); #endregion Fields #region Methods //Return a Class Contaning the Student Info public object getRegistrationDetails(string StudentID) { //Instantiate New List of Students Constructors.StudentAccount StudentInfo = new Constructors.StudentAccount(); StudentAccountList = new List<Constructors.StudentAccount>(new Collections().getStudentAccounts()); //Loop through Records StudentAccountList.ForEach(SAList => { if (SAList.StudentID == Convert.ToInt32(StudentID)) { StudentInfo.EmailAddress = SAList.EmailAddress; StudentInfo.Firstname = SAList.Firstname; StudentInfo.Lastname = SAList.Lastname; StudentInfo.StudentID = SAList.StudentID; StudentInfo.EmailVerified = SAList.EmailVerified; return; } }); return StudentInfo; }