// 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)); }
// 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)); }
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" }); }
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" }); }
private void linkGen(UniversityOffer offer) { throw new NotImplementedException(); }