Skip to content

Instantly share code, notes, and snippets.

@NickJosevski
Last active September 10, 2016 10:45
Show Gist options
  • Save NickJosevski/87125e6ee1c45732995143232a977626 to your computer and use it in GitHub Desktop.
Save NickJosevski/87125e6ee1c45732995143232a977626 to your computer and use it in GitHub Desktop.
AzureFunctions - UsedGuidBasicInput
using System.Net;
public class Input
{
public string Guid {get;set;}
public string UsedBy { get;set;}
}
public static async Task<HttpResponseMessage>
Run(HttpRequestMessage req, TraceWriter log)
{
Input data = await req.Content.ReadAsAsync<Input>();
return (data == null || data.Guid == null || data.UsedBy == null)
? req.CreateResponse<string>(HttpStatusCode.BadRequest, "Please pass a Guid and UsedBy in the request body")
: req.CreateResponse<string>(HttpStatusCode.OK, $"Success {data.Guid} - {data.UsedBy}");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment