Posts

Showing posts from June, 2015

Posting out to 3rd party API

Example of taking data in the form of a Model from your site and sending it out somewhere else and getting back a httpresponsemessage. [HttpPost]   public HttpResponseMessage Post(Appt_Model_DTO  appt)         { >>>>You could eliminate this portion   if (ModelState.IsValid)             { //not necessary but you can run some checks to make sure the data is good //that the model is valid and there is not  //you posted this data from your MVC site to your API Controller //Now we are going to send it off to a third party site                 if (appt.ID == null) {                     appt.ID = my_provider.getRecordwithSameIdentity(appt.AccountCode);                 }                 appt.StartDateTime = DateTime.Now;                 if (appt.POSID ==0)                 {                     return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);                 }   >>>>>> And start here