public RestResponse putStudent(string token, Student student) { var client = new RestClient(WebConfigurationManager.AppSettings["inBloomRestURL"]); var endpoint = "students/" + student.id; var request = inBloomRestRequest(token, endpoint, Method.PUT); request.AddBody(student); RestResponse response = (RestResponse)client.Execute(request); return response; }
public static StudentDisplayObject MapStudentToStudentDisplayObject(Student student, IEnumerable<Section> sections, IEnumerable<Assessment> assessments, IEnumerable<StudentAcademicRecord> academicRecords) { var newStudent = new StudentDisplayObject(); try { 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); //sometime there's no learning style data if (student.learningStyles != null) { newStudent.auditoryLearning = student.learningStyles.auditoryLearning; newStudent.tactileLearning = student.learningStyles.tactileLearning; newStudent.visualLearning = student.learningStyles.visualLearning; } newStudent.birthDate = student.birthData.birthDate.ToShortDateString(); newStudent.profileThumbnail = student.profileThumbnail; newStudent.race = student.race; newStudent.schoolFoodServicesEligiblity = FilterHelper.GetEnumDescription(student.schoolFoodServicesEligiblity); newStudent.section504Disablities = student.section504Disablities; newStudent.studentCharacteristics = from sc in student.studentCharacteristics select FilterHelper.GetEnumDescription(sc.characteristic); newStudent.languages = student.languages; newStudent.homeLanguages = student.homeLanguages; newStudent.learningStyles = student.learningStyles; newStudent.gradeLevel = FilterHelper.GetEnumDescription(student.gradeLevel); newStudent.economicDisadvantaged = student.economicDisadvantaged; newStudent.hispanicLatinoEthnicity = student.hispanicLatinoEthnicity; newStudent.oldEthnicity = FilterHelper.GetEnumDescription(student.oldEthnicity); newStudent.limitedEnglishProficiency = FilterHelper.GetEnumDescription(student.limitedEnglishProficiency); newStudent.otherName = from son in student.otherName select string.Format("{0} {1}", son.firstName, son.lastSurName); newStudent.studentCharacteristics = from sc in student.studentCharacteristics select FilterHelper.GetEnumDescription(sc.characteristic); newStudent.studentIndicators = from si in student.studentIndicators select si.indicator; newStudent.telephones = student.telephones; newStudent.sex = FilterHelper.GetEnumDescription(student.sex); newStudent.displacementStatus = student.displacementStatus; //get the gpa var studentAcademicRecord = academicRecords.FirstOrDefault(a => a.studentId == student.id); newStudent.cumulativeGradePointAverage = studentAcademicRecord != null ? studentAcademicRecord.cumulativeGradePointAverage : 0; newStudent.assessments = assessments; } catch (Exception e) { ExceptionHelper.LogCaughtException(e); } return newStudent; }
public static async Task<StudentDisplayObject> GetStudentDisplayObject(StudentService ss, Student student) { //check to see if the item is already in cache. if so, return the cache item var cache = (StudentDisplayObject)HttpContext.Current.Cache[student.id]; if (cache != null) return cache; var sections = GetSectionsByStudentId(ss, student.id); var assessments = GetStudentAssessmentsByStudentId(ss, student.id); var academicRecords = GetAllStudentsAcademicRecords(ss); await Task.WhenAll(sections, assessments, academicRecords); var sdo = MapStudentToStudentDisplayObject(student, sections.Result, assessments.Result, academicRecords.Result); HttpContext.Current.Cache.Insert(student.id, sdo); return sdo; }