Exemplo n.º 1
0
 //[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));
 }
Exemplo n.º 2
0
        // [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));
        }
Exemplo n.º 3
0
 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"));
            }
        }
Exemplo n.º 6
0
 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"
     });
 }