public IActionResult Get([FromQuery] string message) { Func <Task> function = () => Task.Run(() => _doSomethingService.WriteMessageAtDebug(message, 10)); _service.DoWork(function); return(Ok("works")); }