Last active
January 12, 2016 19:42
-
-
Save IEvangelist/84e0b851d3da42099680 to your computer and use it in GitHub Desktop.
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; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using Microsoft.AspNet.Mvc; | |
namespace WebApplication1.Controllers | |
{ | |
[Route("api/[controller]")] | |
public class RandomController : Controller | |
{ | |
[HttpGet] | |
public async Task<JsonResult> Get() | |
{ | |
var rand = new Random(); | |
await Task.Delay(rand.Next(0, 50)); // Emulate tiny latency... | |
return new JsonResult(new { | |
numbers = Enumerable.Range(1, 10) | |
.Select(i => i * rand.NextDouble()) | |
.ToArray() | |
}); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment