/// <summary> /// AddStudent /// Accepts all necessary values to create a new Student object /// </summary> /// <param name="lastName">(string) last name of the Person</param> /// <param name="firstName">(string) first name of the Person</param> /// <param name="dob">(DateTime) date of birth of the Person</param> /// <param name="gender">(GenderEnum) gender of the Person</param> /// <param name="id">(string) identifier of the Person</param> /// <param name="major">(string) major of the Student</param> /// <param name="units">(float) completed units of the Student</param> /// <param name="gpa">(float) GPA of the student</param> /// <returns>Student object</returns> public Student AddStudent(string lastName, string firstName, DateTime dob, GenderEnum gender, string id, string major, float units, float gpa) { PersonList data = DataStore.LoadData(); Student result = null; Student student = GetStudent(id); if (student == null) { // Student doesn't exist result = new Student() { ID = id, LastName = lastName, FirstName = firstName, DOB = dob, Gender = gender, Major = major, Units = units, GPA = gpa }; data.Add(result); DataStore.SaveData(); } return(result); } // end of method
} // end of method /// <summary> /// AddTeacher /// Accepts all necessary values to create a new Teacher object /// </summary> /// <param name="lastName">(string) last name of the Person</param> /// <param name="firstName">(string) first name of the Person</param> /// <param name="dob">(DateTime) date of birth of the Person</param> /// <param name="gender">(GenderEnum) gender of the Person</param> /// <param name="id">(int) identifier of the Teacher</param> /// <param name="dateofhire">(DateTine) date of hire of the Teacher</param> /// <param name="salary">(int) salary of the Teacher</param> /// <returns>(Teacher) teacher object</returns> public Teacher AddTeacher(string lastName, string firstName, DateTime dob, GenderEnum gender, int idTeacher, DateTime dateofhire, int salary) { PersonList data = DataStore.LoadData(); Teacher result = null; Teacher teacher = GetTeacher(idTeacher); if (teacher == null) { // Teacher doesn't exist, object initialize Teacher result = new Teacher() { LastName = lastName, FirstName = firstName, DOB = dob, Gender = gender, ID = idTeacher, DateOfHire = dateofhire, Salary = salary }; data.Add(result); DataStore.SaveData(); } // end of if return(result); } // end of method