How to create PUT method in WebApiRNRohit Nair10yAsked Jun 18, 2016, 1:27 AM EDT4 answersShareLinkedInXCopy linkSaveHello,I want to call a stored procedure in a web api on PUT method..and how to make route parameters for put method..i am new in web api plzz help and its urgent
How to create PUT method in WebApiRNRohit Nair10yAsked Jun 18, 2016, 1:27 AM EDT4 answersShareLinkedInXCopy linkSaveHello,I want to call a stored procedure in a web api on PUT method..and how to make route parameters for put method..i am new in web api plzz help and its urgent
Atul RawatRank #507 · 4.9K reputation10y agoPosted Jun 19, 2016, 10:46 PM EDT0hello rohitby default in web api method is get. if you want to make method post you need [httpPost] Attribute[httpPost]Public HttpResponseMessage PostMethod(int rohit string str)(Put logic here ....) http://www.c-sharpcorner.com/UploadFile/85ed7a/crud-operation-using-repository-pattern-and-consuming-asp-n33/ no use simple route context.MapHttpRoute( name: "v1_0_defaultApiwithaction", routeTemplate: "v1_0/api/{controller}/{action}/{id}", defaults: new { AreaName = "v1_0", controller = "controller", action = "postmethod", id = RouteParameter.Optional, type = RouteParameter.Optional }); it will work for post and get method if you use Post call you need to Pass values from body with the help of fidller and Postman 0RNRohit Nair142 reputation10y agoPosted Jun 19, 2016, 10:48 PM EDT0Bro i have clearly mentioned i need to make a put method and how to make route parameters of the same...i am aware of post and get0Vinay SinghRank #604 · 4K reputation10y agoPosted Jun 20, 2016, 12:05 AM EDT0 HiTry the below linkshttp://www.c-sharpcorner.com/UploadFile/7d3362/put-and-delete-methods-in-Asp-Net-web-api/http://www.codeproject.com/Articles/890447/Call-WebAPIs-PUT-method-with-complex-input-type-fr0Dr.Ajay KashyapRank #2,900 · 496 reputation10y agoPosted Jun 19, 2016, 10:30 PM EDT-1 [ActionName("PutShops")] [ResponseType(typeof(Shops))] public IHttpActionResult PutShops(int id, Shops shops) { if (!ModelState.IsValid) { return BadRequest(ModelState); } // if (id==null) if (id != shops.Id) { return BadRequest(); } db.Entry(shops).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ShopsExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }-1Join to answer this questionEvery answer you publish earns 20 SHARP.Create free accountSign inKnow the answer?Answer a question in the forums and earn +20 SHARP for every answer.See unanswered questionsForumsTop experts01Arun PottiAnswers in the forums20answers02Tahir AnsariAnswers in the forums5answers03Kamlesh KumarAnswers in the forums5answers04Sam HobbsAnswers in the forums4answers05Željko PerićAnswers in the forums3answers?YouYour name goes here.Every answer: 20 SHARP.JoinFull leaderboard →2026DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
RNRohit Nair142 reputation10y agoPosted Jun 19, 2016, 10:48 PM EDT0Bro i have clearly mentioned i need to make a put method and how to make route parameters of the same...i am aware of post and get0
Vinay SinghRank #604 · 4K reputation10y agoPosted Jun 20, 2016, 12:05 AM EDT0 HiTry the below linkshttp://www.c-sharpcorner.com/UploadFile/7d3362/put-and-delete-methods-in-Asp-Net-web-api/http://www.codeproject.com/Articles/890447/Call-WebAPIs-PUT-method-with-complex-input-type-fr0
Dr.Ajay KashyapRank #2,900 · 496 reputation10y agoPosted Jun 19, 2016, 10:30 PM EDT-1 [ActionName("PutShops")] [ResponseType(typeof(Shops))] public IHttpActionResult PutShops(int id, Shops shops) { if (!ModelState.IsValid) { return BadRequest(ModelState); } // if (id==null) if (id != shops.Id) { return BadRequest(); } db.Entry(shops).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ShopsExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }-1Join to answer this questionEvery answer you publish earns 20 SHARP.Create free accountSign inKnow the answer?Answer a question in the forums and earn +20 SHARP for every answer.See unanswered questionsForumsTop experts01Arun PottiAnswers in the forums20answers02Tahir AnsariAnswers in the forums5answers03Kamlesh KumarAnswers in the forums5answers04Sam HobbsAnswers in the forums4answers05Željko PerićAnswers in the forums3answers?YouYour name goes here.Every answer: 20 SHARP.JoinFull leaderboard →2026DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Atul RawatRank #507 · 4.9K reputationPosted Jun 19, 2016, 10:46 PM EDT
Rohit Nair142 reputationPosted Jun 19, 2016, 10:48 PM EDT
Vinay SinghRank #604 · 4K reputationPosted Jun 20, 2016, 12:05 AM EDT
Dr.Ajay KashyapRank #2,900 · 496 reputationPosted Jun 19, 2016, 10:30 PM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts