public ActionResult CategoryInfo() { var clas = new CategryModel { Clasificados = _readOnlyRepository.GetAll <Classified>().ToList() }; return(View(clas)); }
public ActionResult CategoryInfo(CategryModel info) { var clas = _readOnlyRepository.GetAll <Classified>().ToList(); info.Clasificados = new List <Classified>(clas.Count + 1); foreach (var c in clas.Where(c => c.Categoria == info.Categoria)) { if (String.IsNullOrEmpty(c.UrlImg0)) { c.UrlImg0 = "none"; } if (String.IsNullOrEmpty(c.UrlImg1)) { c.UrlImg1 = "none"; } if (String.IsNullOrEmpty(c.UrlImg2)) { c.UrlImg2 = "none"; } if (String.IsNullOrEmpty(c.UrlImg3)) { c.UrlImg3 = "none"; } if (String.IsNullOrEmpty(c.UrlImg4)) { c.UrlImg4 = "none"; } if (String.IsNullOrEmpty(c.UrlImg5)) { c.UrlImg5 = "none"; } if (String.IsNullOrEmpty(c.UrlVideo)) { c.UrlVideo = "none"; } info.Clasificados.Add(c); { if (info.Clasificados == null) { var clsif = new Classified { Categoria = "none", FechaCreacion = "none", Id = 0, Archived = false, IdUsuario = 0, Descripcion = "none", Negocio = "none", Recomendado = 0, UrlImg0 = "none", Precio = "none", Titulo = "none", UrlImg1 = "nonce", UrlVideo = "none", UrlImg2 = "none", UrlImg3 = "none", UrlImg4 = "none", UrlImg5 = "none", Visitas = 0 }; info.Clasificados.Add(clsif); this.AddNotification("No existen clasificados de esa categoria.", NotificationType.Info); return(View(info)); } } } return(View(info)); }