public HttpResponseMessage GetSearchSponsorships(HttpRequestMessage request, string criteria) { var sponsorships = _studentApi.SearchSponsorships(criteria); var sponsorshipVm = SponsorshipViewModel.MultipleSponsorshipsMap(sponsorships); var response = request.CreateResponse(HttpStatusCode.OK, sponsorshipVm); return(response); }
public HttpResponseMessage GetAllSponsorships(HttpRequestMessage request, string type) { var sponsorships = _studentApi.GetAllSponsorships(type); var sponsorshipVm = SponsorshipViewModel.MultipleSponsorshipsMap(sponsorships); foreach (var sponsorship in sponsorshipVm) { sponsorship.ApplicantCount = _sponsorApi.GetStudentsApplying(sponsorship.ID).Count; sponsorship.SponsorPicturePath = _sponsorApi.GetUserInfo(sponsorship.SponsorId).ProfilePicturePath; } var response = request.CreateResponse(HttpStatusCode.OK, sponsorshipVm); return(response); }