none
I don't get to configure my route in my project with asp.net core 2.0 RRS feed

  • Question

  • This is my Controller

    public class GetClientController : Controller
        {
            LoadClient loadClient = new LoadClient();

            [HttpGet]
            [Route("api/getcliente/{cpf}")]
            public IEnumerable<Cliente> GetCliente([FromQuery]Int64 cpf)
            {
                return loadClient.GetCliente(cpf).AsEnumerable().ToList();
            }
        }

    and below my Model

    public List<Cliente> GetCliente(Int64 cpf)
            {
                List<Cliente> cliente = new List<Cliente>();

                cliente.Add(new Cliente(123456, "p@vb.com", "986754007", "CB", "EML"));
                cliente.Add(new Cliente(908734, "x@cb.com", "988877731", "CB", "SMS"));
                cliente.Add(new Cliente(674300, "p@pf.com", "965241131", "PF", "EML"));
                cliente.Add(new Cliente(101654, "p@ex.com", "987450101", "EX", "EML"));
                cliente.Add(new Cliente(501274, "p@pa.com", "986754144", "PA", "SMS"));

                var lista = cliente
                    .Where(cp => cp.Cpf == cpf).ToList();

                return lista;
            }

    This is my Startup class(I removed the comments)

    public class Startup
        {
            public void ConfigureServices(IServiceCollection services)
            {
                services.AddRouting();
            }

            public void Configure(IApplicationBuilder app, IHostingEnvironment env)
            { 
            }

    What do i must to do?

    

    • Moved by CoolDadTx Tuesday, June 19, 2018 1:53 PM ASP.NET related
    Tuesday, June 19, 2018 1:48 PM

All replies