Fill DropDownList with data obtained from a different controller with MVC

0

I'm starting in this MVC , I had already done a few things in C# , VB.Net and well I still qualify as a rookie just 3 weeks with the MVC . Well, my question is this, I am currently developing a website with MVC where I have two controllers, the first is ProyectosController and the second TipoProyectosController .

ProyectosController I use it to handle the data in the table "Projects" which has a relation with another table called "TypeProjects" and as it is to be assumed in the TipoProyectosController I manipulate the table "TipoPoyectos" and what I want to do is fill dropdownlist with the data I get in TipoProyectosController and then with JQuery I pass the value corresponding field of the view to insert it in the table "Projects" . I currently occupy WEBs-API where I get the data with the following code for both "Projects" and for "TypeProjects":

public ActionResult TiposDeProyectos()
    {
        IEnumerable<TipoProyectosModel> TiposProyectosLista;
        HttpResponseMessage response = GlobalVariables.WebApiClient.GetAsync("TipoProyectos").Result;
        TiposProyectosLista = response.Content.ReadAsAsync<IEnumerable<TipoProyectosModel>>().Result;
        return View(TiposProyectosLista);
    } 
    
asked by Maikel Cutiño Fernández 13.04.2018 в 18:02
source

0 answers