// GET: Noticias public ActionResult Noticias() { var NotBLL = new NoticiaBLL(); List <tblNoticia> listaNoticias = NotBLL.RetrieveAll(); var lvlBLL = new NivelBLL(); tblNivel objLvl; vmListaNoticias objTemp; List <vmListaNoticias> listaFinal = new List <vmListaNoticias>(); foreach (var i in listaNoticias) { objLvl = lvlBLL.RetrieveNivelByID(i.idNivel); string nivelNombre = objLvl.nivelNombre; objTemp = new vmListaNoticias() { idNoticias = i.idNoticias, noticiasTitulo = i.noticiasTitulo, noticiasTexto = i.noticiasTexto, idNivel = nivelNombre }; listaFinal.Add(objTemp); } return(View(listaFinal)); }
public static Noticia ActualizarNoticia(string titulo, string descripcion, string fecha, string id, string idEvento) { NoticiaBLL.Update(titulo, descripcion, fecha, Convert.ToInt32(id), Convert.ToInt32(idEvento)); Noticia objNoticia = NoticiaBLL.SelectById(Convert.ToInt32(id)); return(objNoticia); }
// GET: Noticias/Edit/5 public ActionResult Edit(int id) { var NotBLL = new NoticiaBLL(); tblNoticia objNot = NotBLL.RetrieveNoticiaByID(id); var nivelBLL = new NivelBLL(); List <tblNivel> listaNivel = nivelBLL.RetrieveAll(); ViewBag.idNivel = new SelectList(listaNivel, "idNivel", "nivelNombre", objNot.idNivel); return(View(objNot)); }
public static int EliminarNoticia(int idNoticia) { try { NoticiaBLL.Delete(idNoticia); return(idNoticia); } catch (Exception) { return(-1); } }
// GET: Noticias/Delete/5 public ActionResult DeleteNoticias(int id) { var notBLL = new NoticiaBLL(); wmJsonResult objJson = new wmJsonResult(); try { tblNoticia noticia = notBLL.RetrieveNoticiaByID(id); if (noticia != null) { var lvlBLL = new NivelBLL(); List <tblNivel> listaNivel = lvlBLL.RetrieveNoticiasNivelByID(id); if (listaNivel.Count() >= 0) { //significa que tiene eventos.... } bool banderita = notBLL.Delete(id); if (banderita == true) { objJson.bandera = true; objJson.mensaje = "La noticia se eliminó correctamente"; } else { objJson.bandera = false; objJson.mensaje = "La noticia NO se eliminó correctamente"; } } else { objJson.bandera = false; objJson.mensaje = "La noticia no se encontró"; } } catch { objJson.bandera = false; objJson.mensaje = "Ocurrio una excepcion al eliminar el registro"; } return(Json(objJson, JsonRequestBehavior.AllowGet)); }
public ActionResult Edit(tblNoticia Noticias) { var NotBLL = new NoticiaBLL(); ActionResult Result = null; try { if (ModelState.IsValid) { NotBLL.Update(Noticias); Result = RedirectToAction("Noticias"); } } catch { return(View()); } return(Result); }
public static void Delete(int id) { EventoDSTableAdapters.tbl_eventoTableAdapter adapter = new EventoDSTableAdapters.tbl_eventoTableAdapter(); adapter.DeleteEvento(id); NoticiaBLL.DeleteEvento(id); List <Grupo> listGrupos = GrupoBLL.SelectByEvento(id); foreach (Grupo objGrupo in listGrupos) { GrupoBLL.Delete(objGrupo.IdGrupo); GrupoEquipoBLL.DeleteByGrupo(objGrupo.IdGrupo); List <Fixture> listFixture = FixtureBLL.SelectByGrupo(objGrupo.IdGrupo + ""); foreach (Fixture objFixture in listFixture) { FixtureNoticiaBLL.DeleteByFixture(objFixture.IdFixture); } FixtureBLL.DeleteByGrupo(objGrupo.IdGrupo); } GolesBLL.DeleteByEvento(id); EquipoBLL.DeleteByEvento(id); }
public ActionResult Create(tblNoticia Noticias) { var NotBLL = new NoticiaBLL(); ActionResult Result = null; try { if (ModelState.IsValid) { NotBLL.Create(Noticias); Result = RedirectToAction("Noticias"); } else { Result = RedirectToAction("Noticias"); } } catch { Result = RedirectToAction("Noticias"); } return(Result); }
public static Noticia TraerNoticia(int idNoticia) { Noticia objNoticia = NoticiaBLL.SelectById(idNoticia); return(objNoticia); }
public static Noticia InsertarNoticia(string titulo, string descripcion, string fecha, string idEvento) { Noticia objNoticia = NoticiaBLL.InsertWithReturn(titulo, descripcion, fecha, Convert.ToInt32(idEvento)); return(objNoticia); }