3
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);
}
}
up to the controller, you’re getting the information all right, but the view doesn’t open. what you’d have to do for the Vote view is open?