// 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)); }
// GET: Nivel/Edit/5 public ActionResult Edit(int id) { var lvlBLL = new NivelBLL(); tblNivel objlvl = lvlBLL.RetrieveNivelByID(id); return(View(objlvl)); }
// GET: Nivel public ActionResult Index() { var lvlBLL = new NivelBLL(); List <tblNivel> listaNivel = lvlBLL.RetrieveAll(); return(View(listaNivel)); }
// GET: Noticias/Create public ActionResult Create() { var nivelBLL = new NivelBLL(); List <tblNivel> listaNivel = nivelBLL.RetrieveAll(); ViewBag.idNivel = new SelectList(listaNivel, "idNivel", "nivelNombre"); return(View()); }
// 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)); }
// 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)); }
// GET: Eventos public ActionResult Index() { var eveBLL = new EventoBLL(); List <tblEvento> listaEventos = eveBLL.RetrieveAll(); var lvlBLL = new NivelBLL(); tblNivel objLvl; var ColBLL = new ColaboradorBLL(); tblColaboradore objCol; var AulBLL = new AulaBLL(); tblAula objAul; vmListaEventos objTemp; List <vmListaEventos> listaFinal = new List <vmListaEventos>(); foreach (var i in listaEventos) { objLvl = lvlBLL.RetrieveNivelByID(i.idNivel); string nivelNombre = objLvl.nivelNombre; objCol = ColBLL.RetrieveColaboradorByID(i.idColaborador); string ColaboradorNombre = objCol.nombreColaborador; objAul = AulBLL.RetrieveAulaByID(i.idAula); string AulaNombre = objAul.nombreAula; objTemp = new vmListaEventos() { idEvento = i.idEvento, nombreEvento = i.nombreEvento, descripcionEvento = i.descripcionEvento, fechaEvento = i.fechaEvento.ToShortDateString(), horaInicio = i.horaInicio.ToShortTimeString(), horaFinal = i.horaFinal.ToShortTimeString(), idNivel = nivelNombre, idAula = AulaNombre, idColaborador = ColaboradorNombre }; listaFinal.Add(objTemp); } return(View(listaFinal)); }
public ActionResult Edit(tblNivel nivel) { var lvlBLL = new NivelBLL(); ActionResult Result = null; try { if (ModelState.IsValid) { lvlBLL.Update(nivel); Result = RedirectToAction("Index"); } } catch { return(View()); } return(Result); }
// GET: Eventos/Create public ActionResult Create() { var aulaBLL = new AulaBLL(); List <tblAula> listaAulas = aulaBLL.RetrieveAll(); ViewBag.idAula = new SelectList(listaAulas, "idAula", "nombreAula"); var colaboradorBLL = new ColaboradorBLL(); List <tblColaboradore> listacolaborador = colaboradorBLL.RetrieveAll(); ViewBag.idColaborador = new SelectList(listacolaborador, "idcolaborador", "nombreColaborador"); var nivelBLL = new NivelBLL(); List <tblNivel> listaNivel = nivelBLL.RetrieveAll(); ViewBag.idNivel = new SelectList(listaNivel, "idNivel", "nivelNombre"); return(View()); }
// GET: Eventos/Edit/5 public ActionResult Edit(int id) { var eveBLL = new EventoBLL(); tblEvento objEve = eveBLL.RetrievEventoByID(id); var aulaBLL = new AulaBLL(); List <tblAula> listaAulas = aulaBLL.RetrieveAll(); ViewBag.idAula = new SelectList(listaAulas, "idAula", "nombreAula", objEve.idAula); var colaboradorBLL = new ColaboradorBLL(); List <tblColaboradore> listacolaborador = colaboradorBLL.RetrieveAll(); ViewBag.idColaborador = new SelectList(listacolaborador, "idcolaborador", "nombreColaborador", objEve.idColaborador); var nivelBLL = new NivelBLL(); List <tblNivel> listaNivel = nivelBLL.RetrieveAll(); ViewBag.idNivel = new SelectList(listaNivel, "idNivel", "nivelNombre", objEve.idNivel); return(View(objEve)); }
// GET: Nivel/Delete/5 public JsonResult DeleteNivel(int id) { var lvlBLL = new NivelBLL(); wmJsonResult objJson = new wmJsonResult(); try { tblNivel nivel = lvlBLL.RetrieveNivelByID(id); if (nivel != null) { bool banderita = lvlBLL.Delete(id); if (banderita == true) { objJson.bandera = true; objJson.mensaje = "El nivel se eliminó correctamente"; } else { objJson.bandera = false; objJson.mensaje = "El nivel NO se eliminó correctamente"; } } else { objJson.bandera = false; objJson.mensaje = "El nivel no se encontró"; } } catch { objJson.bandera = false; objJson.mensaje = "Ocurrio una excepcion al eliminar elnivel"; } return(Json(objJson, JsonRequestBehavior.AllowGet)); }
public ActionResult Create(tblNivel nivel) { var lvlBLL = new NivelBLL(); ActionResult Result = null; try { if (ModelState.IsValid) { lvlBLL.Create(nivel); Result = RedirectToAction("Index"); } else { Result = RedirectToAction("Index"); } } catch { Result = RedirectToAction("Index"); } return(Result); }