Skip to content

Instantly share code, notes, and snippets.

@JeremyMorgan
Created April 28, 2014 22:44
Show Gist options
  • Select an option

  • Save JeremyMorgan/11386248 to your computer and use it in GitHub Desktop.

Select an option

Save JeremyMorgan/11386248 to your computer and use it in GitHub Desktop.
Contact Controller - Win API
public HttpResponseMessage Post([FromBody] PostObject ourPostObject)
{
try
{
// Debug.WriteLine(ourPostObject.testValue);
// post object
Mailer ourMailer = new Mailer();
try
{
ourMailer.sendEmail(ourPostObject.recipient, ourPostObject.subject, ourPostObject.message);
}
catch (Exception ex)
{
Debug.WriteLine(ex.ToString());
}
ourPostObject.status = "SENT";
return Request.CreateResponse(HttpStatusCode.OK, ourPostObject);
}
catch (Exception ex)
{
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment