private ClassStanding classStanding; //calling the ClassStanding function to assign classStanding to the enumeration public Student(string Name = "", int Age = 0, ClassStanding classStanding = ClassStanding.Freshman) //creating initial aspects for name, age, and classStanding { //using the this keyword to refer to the current instance of the class this.age = Age; this.name = Name; this.classStanding = classStanding; }
internal async Task<bool> Update(HomeState homeState, ClassStanding classStanding, CollegeName collegeName, Major major) { if (_currentUser != null) { _currentUser.HomeState = homeState; _currentUser.ClassStanding = classStanding; _currentUser.College = collegeName; _currentUser.Major = major; await _usersTable.UpdateAsync(_currentUser); return true; } return false; }
public void Add() //Add will add the user input for name, age and class standing for students { Console.Write("Name: "); //user input for name string name = Console.ReadLine(); Console.Write("Age: "); //user input for age int age = int.Parse(Console.ReadLine()); //convert the age string to an integer Console.Write("Class Standing: "); string classStandingString = Console.ReadLine(); //user input for class standing ClassStanding classStanding = (ClassStanding)Enum.Parse(typeof(ClassStanding), classStandingString); //this converts string representation of the name to an enumerated object Student student = new Student(name, age, classStanding); //calling the student function and using the inputted name, age, and class standing to format it in this order studentList.Add(student); //adding the user input into the list }
internal List<User> Search(HomeState homeState, ClassStanding classStanding, CollegeName collegeName, Major major) { List<User> mentorList = _usersList.Where(User => User.IsMentor).ToList(); if(homeState != HomeState.NA) { mentorList = mentorList.Where(User => User.HomeState == homeState).ToList(); } if(classStanding != ClassStanding.NA) { mentorList = mentorList.Where(User => User.ClassStanding == classStanding).ToList(); } if (collegeName != CollegeName.NA) { mentorList = mentorList.Where(User => User.College == collegeName).ToList(); } if (major != Major.NA) { mentorList = mentorList.Where(User => User.Major == major).ToList(); } mentorList.OrderBy(User => User.College).ThenBy(User => User.Major).ThenBy(User => User.HomeState).ThenBy(User => User.ClassStanding); return mentorList; }