예제 #1
0
        public HttpResponseMessage ApplyForSponsorship(HttpRequestMessage request,
                                                       StudentSponsorshipViewModel application)
        {
            var newApplication = new StudentSponsorship()
            {
                StudentId          = application.StudentId,
                SponsorshipId      = application.SponsorshipId,
                ApplicationDate    = application.ApplicationDate,
                SponsorshipOffered = application.SponsorshipOffered,
                Status             = application.Status
            };

            _studentApi.ApplyForSponsorship(newApplication);

            var sponsorship = _studentApi.GetSponsorship(newApplication.SponsorshipId);

            var sponsor = _sponsorApi.GetSponsor(sponsorship.SponsorId);

            sponsor.BursifyScore += 2;

            _sponsorApi.SaveSponsor(sponsor);

            var model = new StudentSponsorshipViewModel();

            var applicationVm = model.MapSIngleStudentSponsorship(newApplication);

            var response = request.CreateResponse(HttpStatusCode.Created, applicationVm);

            return(response);
        }
예제 #2
0
 public StudentSponsorship MapSIngleStudentSponsorship(StudentSponsorship studentSponsorship)
 {
     return(new StudentSponsorship()
     {
         StudentId = studentSponsorship.StudentId,
         SponsorshipId = studentSponsorship.SponsorshipId,
         SponsorshipOffered = studentSponsorship.SponsorshipOffered,
         ApplicationDate = studentSponsorship.ApplicationDate,
         Status = studentSponsorship.Status
     });
 }