I have this code that passes parameters to my controller:
var id = $(Musico).val();
var url = '@Url.Action("Votar","Chamada")';
var tipo = 1;
$.ajax({
url: url,
data: {
id:id, tipo:tipo
}
});
My controller:
public ActionResult Votar(int id, int tipo)
{
if (tipo == 1)//Tipo Musico
{
var chamadaMusicas = db.ChamadaMusicas.Include(c => c.Chamada).Include(c => c.Musica).Where(c => c.Chamada.PessoaID.Equals(id)).Where(i => i.Chamada.Ativa.Equals(true)).ToList();
return View(chamadaMusicas);//Fábio Souza);
}
else//Local
{
var chamadaMusicas = db.ChamadaMusicas.Include(c => c.Chamada).Include(c => c.Musica).Where(c => c.Chamada.LocalID.Equals(id));
return View(chamadaMusicas.ToList().Where(i => i.Chamada.Ativa.Equals(true)));//Fábio Souza);
}
}
until the controller is receiving all the information, but the view does not open. What would you have to do for the Vote view to open?