/// <summary> /// update existing student info /// </summary> /// <param name="s"></param> public static void UpdateStudent(PLStudent s) { SLStudent.Student newStudent = DTO_to_SL(s); SLStudent.ISLStudent SLStudent = new SLStudent.SLStudentClient(); string[] errors = new string[0]; SLStudent.UpdateStudentRequest request = new SLStudent.UpdateStudentRequest(newStudent, errors); SLStudent.UpdateStudent(request); }
/// <summary> /// call service layer's delete student method /// </summary> /// <param name="id"></param> public static bool DeleteStudent(string id) { SLStudent.ISLStudent SLStudent = new SLStudent.SLStudentClient(); string[] errors = new string[0]; SLStudent.DeleteStudentRequest request = new SLStudent.DeleteStudentRequest(id, errors); SLStudent.DeleteStudentResponse response = SLStudent.DeleteStudent(request); if (response.errors.Length > 0) { return(false); } return(true); }
/// <summary> /// Get student detail /// </summary> /// <param name="id"></param> /// <returns></returns> public static PLStudent GetStudentDetail(string id) { SLStudent.ISLStudent SLStudent = new SLStudent.SLStudentClient(); string[] errors = new string[0]; SLStudent.GetStudentRequest request = new SLStudent.GetStudentRequest(id, errors); SLStudent.GetStudentResponse response = SLStudent.GetStudent(request); SLStudent.Student newStudent = response.GetStudentResult; // this is the data transfer object code... if (newStudent == null) { System.Diagnostics.Debug.WriteLine("DALStudent getStudentDetail is f****d up!"); } return(DTO_to_PL(newStudent)); }
public static List <PLStudent> GetStudentList() { List <PLStudent> studentList = new List <PLStudent>(); SLStudent.ISLStudent client = new SLStudent.SLStudentClient(); string[] errors = new string[0]; SLStudent.GetStudentListRequest request = new SLStudent.GetStudentListRequest(errors); SLStudent.GetStudentListResponse response = client.GetStudentList(request); SLStudent.Student[] studentsLoaded = response.GetStudentListResult; foreach (SLStudent.Student s in studentsLoaded) { PLStudent student = DTO_to_PL(s); studentList.Add(student); } return(studentList); }