Last active
September 10, 2016 10:45
-
-
Save NickJosevski/87125e6ee1c45732995143232a977626 to your computer and use it in GitHub Desktop.
AzureFunctions - UsedGuidBasicInput
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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