Пример #1
0
        public HttpResponseMessage GetStudentsApplying(HttpRequestMessage request, int sponsorshipId)
        {
            var students = _sponsorApi.GetStudentsApplying(sponsorshipId);

            var s = StudentViewModel.MapMultipleStudents(students);

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

            return(response);
        }
Пример #2
0
        public HttpResponseMessage GetStudentsSponsored(HttpRequestMessage request, int sponsorshipId)
        {
            var students = _sponsorApi.GetStudentsSponsored(sponsorshipId);

            var s = StudentViewModel.MapMultipleStudents(students);

            foreach (var current in s)
            {
                var report  = _studentApi.GetMostRecentReport(current.ID);
                var address = _studentApi.GetAddress(current.ID, "Residential");

                current.Average  = report.Average;
                current.School   = report.ReportInstitution;
                current.Province = address.Province;
            }

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

            return(response);
        }
Пример #3
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);
        }