Created
September 6, 2016 09:02
-
-
Save ahelland/76d44ca7619b5a06e730f4488ab0e20f to your computer and use it in GitHub Desktop.
Azure Function returning word pairs
This file contains hidden or 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 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