1
I am unable to bring the list of products that has at least 1 related category.
//Classe
public class EventoConfiguracaoViewModel
{
public EventoConfiguracaoViewModel()
{
Menus = new List<MenuViewModel>();
Categorias = new List<CategoriaViewModel>();
Produtos = new List<ProdutoViewModel>();
CupomDescontos = new List<CupomDesconto>();
MenuLaterais =new List<MenuLateralViewModel>();
}
[Key]
public int Id { get; set; }
public string Nome { get; set; }
public int CdEvento { get; set; }
public virtual EventoViewModel Evento { get; set; }
public virtual ICollection<MenuViewModel> Menus { get; set; }
public ICollection<MenuLateralViewModel> MenuLaterais { get; set; }
public virtual ICollection<CategoriaViewModel> Categorias { get; set; }
public virtual ICollection<ProdutoViewModel> Produtos { get; set; }
public virtual ICollection<CupomDesconto> CupomDescontos { get; set; }
}
I did it that way and it didn’t work:
public ActionResult ObterProdutoPorCategoria(int? id, string categoria, int? clienteId, int? cdEvento, string tema)
{
ViewBag.Tema = tema;
var configuracao = _eventoConfiguracaoAppService.ObterTodosEventoConfiguracaosDoClientes(clienteId.Value,
cdEvento.Value);
var retv = configuracao.Where(e => e.Produtos.Any(p => p.CategoriaId == 2));
return View(retv);
}
Please try to be more specific. Click [Edit] and give more details. It is impossible to help you without knowing what you are talking about.
– Jéf Bueno
Like I’m not being specific right now. I informed in the text: "Staff I am unable to bring the list of products that has at least 1 related category."
– ts.analista
Instead of print, put the code that makes it much easier to read. I believe it only takes the structure of the Configuration and Product class, and the code you are using today to perform the filter
– Vinícius
Ready... I put the code
– ts.analista
View takes which model?
– Marco Vinicius Soares Dalalba
Receive a Ienumerable<Eventoconfiguracaoviewmodel>
– ts.analista