コード例 #1
0
 // PUT api/<controller>/5
 public IHttpActionResult Put([FromUri] int uId, [FromUri] int id, [FromBody] UniversityOffer universityOffer)
 {
     universityOffer.UniversityId = uId;
     universityOffer.id           = id;
     offerRep.Update(universityOffer);
     linkGen(universityOffer);
     return(Ok(universityOffer));
 }
コード例 #2
0
        // POST api/<controller>
        public IHttpActionResult Post([FromBody] UniversityOffer universityOffer, [FromUri] int uId)
        {
            universityOffer.UniversityId = uId;
            offerRep.Insert(universityOffer);
            linkGen(universityOffer);
            string url = Url.Link("GetOfferById", new { uId = universityOffer.UniversityId, id = universityOffer.id });

            return(Created(url, universityOffer));
        }
コード例 #3
0
 public void linkGen(UniversityOffer offer, int sId)
 {
     offer.links.Add(new Links()
     {
         HRef = "http://localhost:44348/api/student/" + sId + "/universityoffer/", Method = "GET", Rel = "Get all the university offer list"
     });
     offer.links.Add(new Links()
     {
         HRef = "http://localhost:44348/api/student/" + sId + "/universityoffer/" + offer.id, Method = "GET", Rel = "Get specific university offer"
     });
 }
コード例 #4
0
 public void linkGen(UniversityOffer offer)
 {
     offer.links.Add(new Links()
     {
         HRef = "http://localhost:44348/api/universities/" + offer.UniversityId + "/offers", Method = "GET", Rel = "Get all the Scholarship offer list offered by a university"
     });
     offer.links.Add(new Links()
     {
         HRef = "http://localhost:44348/api/universities/" + offer.UniversityId + "/offers/" + offer.id, Method = "GET", Rel = "Get an specified Scholarship offer by ID"
     });
     offer.links.Add(new Links()
     {
         HRef = "http://localhost:44348/api/universities/" + offer.UniversityId + "/offers", Method = "POST", Rel = "Create a new Scholarship offer resource"
     });
     offer.links.Add(new Links()
     {
         HRef = "http://localhost:44348/api/universities/" + offer.UniversityId + "/offers/" + offer.id, Method = "PUT", Rel = "Modify an existing Scholarship offer resource"
     });
     offer.links.Add(new Links()
     {
         HRef = "http://localhost:44348/api/universities/" + offer.UniversityId + "/offers/" + offer.id, Method = "DELETE", Rel = "Delete an existing Scholarship offer resource"
     });
 }
コード例 #5
0
 private void linkGen(UniversityOffer offer)
 {
     throw new NotImplementedException();
 }