public List <Atuendo> generarAtuendos() { DB db = new DB(); guardarropaXusuarioRepository guardarropaDAO = new guardarropaXusuarioRepository(); GuardarropaRepository guardarropaREP = new GuardarropaRepository(); GenerarSugerencias generador = new GenerarSugerencias(); TipoPrendaRepository tpr = new TipoPrendaRepository(); List <Atuendo> atuendos = new List <Atuendo>(); List <guardarropaXusuarioRepository> guardarropasParciales = guardarropaDAO.listarGuardarropasDeUsuario(id_usuario); List <List <Prenda> > prendas = new List <List <Prenda> >(); foreach (guardarropaXusuarioRepository g in guardarropasParciales) { prendas.Add(guardarropaREP.PrendasDelGuardarropas(g.id_guardarropa, db)); } foreach (List <Prenda> p in prendas) { foreach (Prenda pr in p) { pr.tipo = tpr.TraerTipoDePrendaPorId(pr.tipoPrenda); } } foreach (List <Prenda> p in prendas) { atuendos.AddRange(generador.ejecutarGenerar(20, p, this)); } return(atuendos); }
public IActionResult VerPrendasDelGuardarropas(int idGuardarropa, int idUsuario) { DB db = new DB(); GuardarropaRepository guardarropaDAO = new GuardarropaRepository(); Guardarropa guardarropa = guardarropaDAO.buscarGuardarropaPorId(idGuardarropa); List <Prenda> prendas = guardarropaDAO.PrendasDelGuardarropas(idGuardarropa, db); ViewBag.Prendas = prendas; ViewBag.IdGuardarropa = idGuardarropa; ViewBag.nombreGuardarropa = guardarropa.nombreGuardarropas; ViewBag.Id = idUsuario; return(View("PrendasDelGuardarropa")); }