public ActionResult Codes_New(LIMITATION newLimitation) { try { BLTServiceCaller serviceCaller = BLTServiceCaller.Instance; var request = new RestRequest(Method.POST); request.Resource = "/Limitations"; request.RequestFormat = DataFormat.Xml; request.AddHeader("Content-Type", "application/xml"); //Use extended serializer BLTWebSerializer serializer = new BLTWebSerializer(); request.AddParameter("application/xml", serializer.Serialize<LIMITATION>(newLimitation), ParameterType.RequestBody); LIMITATION createdLimitation = serviceCaller.Execute<LIMITATION>(request); return RedirectToAction("../Parts/Index"); } catch (Exception e) { return View(e.ToString()); } }
public ActionResult Codes_Edit(int id, LIMITATION editedCode) { BLTServiceCaller serviceCaller = BLTServiceCaller.Instance; var request = new RestRequest(Method.POST); request.Resource = "/Limitations/{entityID}"; request.RequestFormat = DataFormat.Xml; request.AddParameter("entityID", id, ParameterType.UrlSegment); request.AddHeader("X-HTTP-Method-Override", "PUT"); //Use extended serializer BLTWebSerializer serializer = new BLTWebSerializer(); request.AddParameter("application/xml", serializer.Serialize<LIMITATION>(editedCode), ParameterType.RequestBody); LIMITATION updatedCode = serviceCaller.Execute<LIMITATION>(request); //update the AI and go back to the AI index return RedirectToAction("Index"); }