public static async Task<StudentDisplayObject> GetStudentDisplayObject(StudentService cs, Student student) { var sections = GetSectionsByStudentId(cs, student.id); var assessments = GetStudentAssessmentsByStudentId(cs, student.id); await Task.WhenAll(sections, assessments); var result = MapStudentToStudentDisplayObject(student, sections.Result, assessments.Result); return result; }
public static StudentDisplayObject MapStudentToStudentDisplayObject(Student student, IEnumerable<Section> sections, IEnumerable<Assessment> assessments) { var newStudent = new StudentDisplayObject(); newStudent.id = student.id; newStudent.name = string.Format("{0} {1}", student.name.firstName, student.name.lastSurName); newStudent.sections = from s in sections select s.id; newStudent.disabilities = from d in student.disabilities select FilterHelper.GetEnumDescription(d.disability).title; newStudent.learningStyles = student.learningStyles; newStudent.assessments = assessments; return newStudent; }
public async Task<string> CreateOneAssociation(CohortService cs, string cId, Student s) { var a = new StudentCohortAssociation { cohortId = cId, studentId = s.id, beginDate = DateTime.Now }; var result = await cs.CreateStudentCohortAssociation(a); return result.ToString(); }