public ActionResult Evento(NuevoEventoForm model, HttpPostedFileBase file) { string extension = ""; if (file != null) { extension = System.IO.Path.GetExtension(file.FileName).ToLower(); } ActionResponses ar = null; string msg = null; if (file != null && extension != ".jpg" && extension != ".jpeg" && extension != ".gif" && extension != ".png" && extension != ".bmp") { msg = "Formato de imágen incorrecto"; ar = new ActionResponses(ResponseType.ERROR, msg); ViewBag.ActionResponses = ar; } if (ModelState.IsValid) { try { //Crea conexión a base de datos SistemaEmprendedorEntities bd = new SistemaEmprendedorEntities(); FileUploadController upload = new FileUploadController(); << << << < HEAD Evento NuevoEventoObj = new Evento();
// Activar public ActionResult Activar(int tipo, int id) { SistemaEmprendedorEntities bd = new SistemaEmprendedorEntities(); ActionResponses ar = null; string msg = null; if (tipo == 1) { Evento EventoActivar = bd.Evento.Where(x => x.id == id).Select(x => x).FirstOrDefault(); if (EventoActivar != null) { try { EventoActivar.estatus = 2; bd.Entry(EventoActivar).State = System.Data.Entity.EntityState.Modified; bd.SaveChanges(); } catch (Exception ex) { msg = "Existe un problema al activar este evento, consulta al administrador"; ar = new ActionResponses(ResponseType.ERROR, msg); ViewBag.ActionResponses = ar; TempData["Message"] = ar; return(RedirectToAction("AdministrarEventos", "Manage")); } msg = "Evento activado correctamente"; ar = new ActionResponses(ResponseType.SUCCESS, msg); ViewBag.ActionResponses = ar; TempData["Message"] = ar; return(RedirectToAction("AdministrarEventos", "Manage")); } } return(RedirectToAction("Index", "Home")); }
// GET: /Admin Organizaciones public ActionResult AdministrarOrganizaciones() { SistemaEmprendedorEntities bd = new SistemaEmprendedorEntities(); ManageCatalogo Manage = new ManageCatalogo(); Manage.ListaOrganizaciones = bd.Organizacion.ToList(); return(View(Manage)); }
// GET: /Admin Emprendedores public ActionResult AdministrarEmprendedores() { SistemaEmprendedorEntities bd = new SistemaEmprendedorEntities(); ManageCatalogo Manage = new ManageCatalogo(); Manage.ListaEmprendedor = bd.Emprendedor.ToList(); return(View(Manage)); }
// // GET: /Lista de usuarios public ActionResult Usuarios() { SistemaEmprendedorEntities bd = new SistemaEmprendedorEntities(); Usuarios Users = new Usuarios(); Users.UsersList = bd.AspNetUsers.ToList(); return(View(Users)); }
// // GET: /Lista de asistentes public ActionResult AsistentesEvento(int idEvento) { SistemaEmprendedorEntities bd = new SistemaEmprendedorEntities(); ManageCatalogo model = new ManageCatalogo(); model.ListaAsistentesDeEventos = bd.RegistroAEvento.Where(x => x.IdEvento == idEvento).Select(x => x).ToList(); model.Evento = bd.Evento.Where(x => x.id == idEvento).Select(x => x).FirstOrDefault(); return(View(model)); }
// GET: /Admin eventos public ActionResult AdministrarEventos() { SistemaEmprendedorEntities bd = new SistemaEmprendedorEntities(); ManageCatalogo Manage = new ManageCatalogo(); string ar = null; Manage.ListaEventos = bd.Evento.ToList(); if (TempData["Message"] != null) { ViewBag.ActionResponses = TempData["Message"]; } return(View(Manage)); }
// Eliminar public ActionResult Eliminar(int tipo, int id) { SistemaEmprendedorEntities bd = new SistemaEmprendedorEntities(); ActionResponses ar = null; ManageCatalogo model = new ManageCatalogo(); string msg = null; if (tipo == 1) { Evento EventoBorrar = bd.Evento.Where(x => x.id == id).Select(x => x).FirstOrDefault(); if (EventoBorrar != null) { try { model.ListaAsistentesDeEventos = bd.RegistroAEvento.Where(x => x.IdEvento == id).Select(x => x).ToList(); if (model.ListaAsistentesDeEventos != null) { foreach (var Asistente in model.ListaAsistentesDeEventos) { bd.Entry(Asistente).State = System.Data.Entity.EntityState.Deleted; bd.SaveChanges(); } } bd.Entry(EventoBorrar).State = System.Data.Entity.EntityState.Deleted; bd.SaveChanges(); } catch (Exception ex) { msg = "Existe un problema al eliminar este evento, consulta al administrador"; ar = new ActionResponses(ResponseType.ERROR, msg); ViewBag.ActionResponses = ar; TempData["Message"] = ar; return(RedirectToAction("AdministrarEventos", "Manage")); } msg = "Evento eliminado correctamente"; ar = new ActionResponses(ResponseType.SUCCESS, msg); ViewBag.ActionResponses = ar; TempData["Message"] = ar; return(RedirectToAction("AdministrarEventos", "Manage")); } } return(RedirectToAction("Index", "Home")); }