Created
February 25, 2020 03:24
-
-
Save carloscds/88bd15785dbd5a670255701b876c825d 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 System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.Extensions.Logging; | |
namespace InjecaoDependenciaASPNETCore.Controllers | |
{ | |
[ApiController] | |
[Route("[controller]")] | |
public class HomeController : ControllerBase | |
{ | |
private readonly IServico _servico; | |
private readonly ExecutaServico _executaServico; | |
public HomeController(IServico servico, ExecutaServico executaServico) | |
{ | |
_servico = servico; | |
_executaServico = executaServico; | |
} | |
[HttpGet] | |
public string Get() | |
{ | |
var textoServico = _servico.RetornaValor(); | |
var textoExecutaServico = _executaServico.RetornaServicoExecutado(); | |
return $"Servico: {textoServico} - ExecutaServico: {textoExecutaServico}"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment