-
-
Save jrob5756/96f21e6f6e264f32f14be928821ef11d to your computer and use it in GitHub Desktop.
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 Microsoft.AspNetCore.Mvc; | |
namespace JrTech.AspNetCore.Web.Controllers | |
{ | |
[Route("api/[controller]")] | |
public class ValuesController : Controller | |
{ | |
private readonly IFactory<IRandomNumberGenerator> _numberGeneratorFactory; | |
public ValuesController(IFactory<IRandomNumberGenerator> numberGeneratorFactory) | |
{ | |
_numberGeneratorFactory = numberGeneratorFactory; | |
} | |
// GET api/values | |
[HttpGet] | |
public string Get() | |
{ | |
var generator = _numberGeneratorFactory.Create(); | |
return $"randomNumber - {generator.Get()}" ; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment