コード例 #1
0
        public HttpResponseMessage GetStudentSuggestions(HttpRequestMessage request, int sponsorId)
        {
            var students = _studentApi.GetStudentSuggestions(sponsorId);

            var studentsVm = StudentViewModel.MapMultipleStudents(students);

            foreach (var model in studentsVm)
            {
                var report = _studentApi.GetMostRecentReport(model.ID);
                model.InstitutionName = _studentApi.GetInstitution(model.InstitutionID).Name;
                model.ImagePath       = _studentApi.GetUserInfo(model.ID).ProfilePicturePath;

                if (report != null)
                {
                    model.AverageMark = report.Average;
                }
            }

            var response = request.CreateResponse(HttpStatusCode.OK, studentsVm);

            return(response);
        }