Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save wellingtonjhn/621adfa4f79034d71c2c7f19051d87da to your computer and use it in GitHub Desktop.

Select an option

Save wellingtonjhn/621adfa4f79034d71c2c7f19051d87da to your computer and use it in GitHub Desktop.
Controller without any try...catch statement
[Route("api/[controller]")]
[ApiController]
public class ValuesController : ControllerBase
{
private readonly FakeData _data;
public ValuesController(FakeData data)
{
_data = data;
}
[HttpGet]
public ActionResult<int> Get()
{
return _data.GetRandomNumber();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment