Skip to content

Instantly share code, notes, and snippets.

@ahelland
Created September 6, 2016 09:02
Show Gist options
  • Save ahelland/76d44ca7619b5a06e730f4488ab0e20f to your computer and use it in GitHub Desktop.
Save ahelland/76d44ca7619b5a06e730f4488ab0e20f to your computer and use it in GitHub Desktop.
Azure Function returning word pairs
using System.Net;
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
{
log.Info($"C# HTTP trigger function processed a request. RequestUri={req.RequestUri}");
var responseMsg = String.Empty;
Random r = new Random();
int rInt = r.Next(0,4);
responseMsg = GetQuote(rInt);
return req.CreateResponse(HttpStatusCode.OK, responseMsg);
}
public static string GetQuote(int i)
{
switch (i)
{
case 0:
return "Rum,Coke";
case 1:
return "Gin,Tonic";
case 2:
return "Vodka,OJ";
case 3:
return "Martini,Olives";
case 4:
return "Tequila,Blackout";
default:
return "Hello,World";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment