public ActionResult Index(string search) { ViewBag.Message = TempData["Message"]; var buPortafolio = new BuPortafolio(); var portafolios = buPortafolio.GetAll(); if (portafolios != null && !string.IsNullOrEmpty(search)) { portafolios = portafolios.Where(x => x.Name.Contains(search)); } if (portafolios != null) { var categorias = new BuCategoriaComponente().GetAll(); var prioridades = new BuPrioridad().GetAll(); var estados = new BuEstado().GetAll(); var trabajadores = new BuTrabajador().GetAll(); foreach (var portafolio in portafolios) { portafolio.CategoriaComponente = categorias.FirstOrDefault(x => x.Id.Equals(portafolio.CategoriaComponenteId)); portafolio.Prioridad = prioridades.FirstOrDefault(x => x.Id.Equals(portafolio.PrioridadId)); portafolio.Estado = estados.FirstOrDefault(x => x.Id.Equals(portafolio.EstadoId)); portafolio.Responsable = trabajadores.FirstOrDefault(x => x.Id.Equals(portafolio.ResponsableId)); } } else { portafolios = new List <Portafolio>(); } return(View(portafolios.OrderBy(x => x.Name))); }
public Portafolio GetPortafolio(int id, bool loadStatisticalData) { var portafolio = new BuPortafolio().GetFullById(id, loadStatisticalData); return(portafolio); }