コード例 #1
0
        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();
コード例 #2
0
        // 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"));
        }
コード例 #3
0
        // GET: /Admin Organizaciones
        public ActionResult AdministrarOrganizaciones()
        {
            SistemaEmprendedorEntities bd     = new SistemaEmprendedorEntities();
            ManageCatalogo             Manage = new ManageCatalogo();

            Manage.ListaOrganizaciones = bd.Organizacion.ToList();
            return(View(Manage));
        }
コード例 #4
0
        // GET: /Admin Emprendedores
        public ActionResult AdministrarEmprendedores()
        {
            SistemaEmprendedorEntities bd     = new SistemaEmprendedorEntities();
            ManageCatalogo             Manage = new ManageCatalogo();

            Manage.ListaEmprendedor = bd.Emprendedor.ToList();
            return(View(Manage));
        }
コード例 #5
0
        //
        // GET: /Lista de usuarios
        public ActionResult Usuarios()
        {
            SistemaEmprendedorEntities bd = new SistemaEmprendedorEntities();
            Usuarios Users = new Usuarios();

            Users.UsersList = bd.AspNetUsers.ToList();
            return(View(Users));
        }
コード例 #6
0
        //
        // 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));
        }
コード例 #7
0
        // 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));
        }
コード例 #8
0
        // 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"));
        }