Skip to content

Instantly share code, notes, and snippets.

@cch12313
Created August 8, 2022 13:48
Show Gist options
  • Save cch12313/d2f76137da9a6e0190be7470734cc606 to your computer and use it in GitHub Desktop.
Save cch12313/d2f76137da9a6e0190be7470734cc606 to your computer and use it in GitHub Desktop.
public class HappyService
{
public HappyService()
{
Console.WriteLine("HappyService create");
}
public void Do()
{
Console.WriteLine("Ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha");
}
}
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private readonly HappyService _happy;
public WeatherForecastController(HappyService happy)
{
_happy = happy;
}
[HttpGet]
public ActionResult Get()
{
_happy.Do();
return Ok();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment