//[BasicAuthentication] // PUT api/<controller>/5 public IHttpActionResult Put([FromUri] int uId, [FromUri] int id, [FromBody] OrganizationOffer organizationOffer) { organizationOffer.organization_id = uId; organizationOffer.id = id; offerRep.Update(organizationOffer); linkGen(organizationOffer); return(Ok(organizationOffer)); }
// [BasicAuthentication] // POST api/<controller> public IHttpActionResult Post([FromBody] OrganizationOffer organizationOffer, [FromUri] int uId) { organizationOffer.organization_id = uId; offerRep.Insert(organizationOffer); linkGen(organizationOffer); string url = Url.Link("GetOfferByIds", new { uId = organizationOffer.organization_id, id = organizationOffer.id }); return(Created(url, organizationOffer)); }
public void linkGen(OrganizationOffer offer, int sId) { offer.links.Add(new Links() { HRef = "http://localhost:44348/api/student/" + sId + "/orgoffer/", Method = "GET", Rel = "Get all the org offer list" }); offer.links.Add(new Links() { HRef = "http://localhost:44348/api/student/" + sId + "/orgoffer/" + offer.id, Method = "GET", Rel = "Get specific org offer" }); }
public ActionResult Edit(OrganizationOffer offer) { try { Orgoffer.Update(offer); return(RedirectToAction("Details", new { @id = offer.id })); } catch { TempData["error"] = "Some Field is Blank!"; return(RedirectToAction("Edit")); } }
public ActionResult Offer(OrganizationOffer offer) { try { Orgoffer.Insert(offer); return(RedirectToAction("Index", "Organisation")); } catch { TempData["error"] = "Some Field is Blank!"; return(RedirectToAction("Offer")); } }
public void linkGen(OrganizationOffer offer) { offer.links.Add(new Links() { HRef = "http://localhost:44348/api/organisations/" + offer.organization_id + "/offers", Method = "GET", Rel = "Get all the Scholarship offer list offered by a organisations" }); offer.links.Add(new Links() { HRef = "http://localhost:44348/api/organisations/" + offer.organization_id + "/offers/" + offer.id, Method = "GET", Rel = "Get an specified Scholarship offer by ID" }); offer.links.Add(new Links() { HRef = "http://localhost:44348/api/organisations/" + offer.organization_id + "/offers", Method = "POST", Rel = "Create a new Scholarship offer resource" }); offer.links.Add(new Links() { HRef = "http://localhost:44348/api/organisations/" + offer.organization_id + "/offers/" + offer.id, Method = "PUT", Rel = "Modify an existing Scholarship offer resource" }); offer.links.Add(new Links() { HRef = "http://localhost:44348/api/organisations/" + offer.organization_id + "/offers/" + offer.id, Method = "DELETE", Rel = "Delete an existing Scholarship offer resource" }); }