public IActionResult Index()
        {
            PartidoContext context  = HttpContext.RequestServices.GetService(typeof(PartidoContext)) as PartidoContext;
            var            partidos = context.getPartidos();

            return(View(partidos));
        }
        public IActionResult Edit(int id, string inputFecha, string inputHora, int selectDisciplina, int selectEquipo1, int selectEquipo2, int selectUbicacion, int selectEvento)
        {
            PartidoContext context = HttpContext.RequestServices.GetService(typeof(PartidoContext)) as PartidoContext;
            bool           result  = context.editPartido(id, inputFecha, inputHora, selectDisciplina, selectEquipo1, selectEquipo2, selectUbicacion, selectEvento);

            if (result)
            {
                return(RedirectToAction("Nuevo", "Partido", new { result = "Success" }));
            }
            return(RedirectToAction("Nuevo", "Partido", new { result = "Failure" }));
        }
        public IActionResult Delete(int id)
        {
            PartidoContext context = HttpContext.RequestServices.GetService(typeof(PartidoContext)) as PartidoContext;
            bool           result  = context.eliminarPartido(id);

            if (result)
            {
                return(RedirectToAction("Index", "Partido", new { result = "Success" }));
            }
            return(RedirectToAction("Index", "Partido", new { result = "Failure" }));
        }
        public IActionResult Details(int id)
        {
            PartidoContext context = HttpContext.RequestServices.GetService(typeof(PartidoContext)) as PartidoContext;

            //bool result = context.GetPartido();

            /*if (result)
             * {
             *  return RedirectToAction("Index", "Partido", new { result = "Success" });
             * }*/
            return(RedirectToAction("Index", "Partido", new { result = "Failure" }));
        }
        public IActionResult Edit(string id)
        {
            EquipoContext     equipos     = HttpContext.RequestServices.GetService(typeof(EquipoContext)) as EquipoContext;
            DisciplinaContext disciplinas = HttpContext.RequestServices.GetService(typeof(DisciplinaContext)) as DisciplinaContext;
            UbicacionContext  ubicaciones = HttpContext.RequestServices.GetService(typeof(UbicacionContext)) as UbicacionContext;
            EventoContext     eventos     = HttpContext.RequestServices.GetService(typeof(EventoContext)) as EventoContext;
            PartidoContext    partidos    = HttpContext.RequestServices.GetService(typeof(PartidoContext)) as PartidoContext;

            ViewBag.equipos     = equipos.GetAllEquipos();
            ViewBag.disciplinas = disciplinas.getDisciplinas();
            ViewBag.eventos     = eventos.getEventos();
            ViewBag.ubicaciones = ubicaciones.getUbicaciones();
            ViewBag.partido     = partidos.GetPartido(id);
            return(View());
        }
示例#6
0
        public IActionResult Evento(int id)
        {
            EventoContext      context  = HttpContext.RequestServices.GetService(typeof(EventoContext)) as EventoContext;
            CompetenciaContext context1 = HttpContext.RequestServices.GetService(typeof(CompetenciaContext)) as CompetenciaContext;
            PartidoContext     context2 = HttpContext.RequestServices.GetService(typeof(PartidoContext)) as PartidoContext;
            List <Partido>     partidos = context2.getPartidos();

            partidos = partidos.Where(x => x.evento.id == id).ToList();
            List <Competencia> competencias = context1.getCompetencias();

            competencias         = competencias.Where(x => x.evento.id == id).ToList();
            ViewBag.Evento       = context.detallesEvento(id);
            ViewBag.Partidos     = partidos;
            ViewBag.Competencias = competencias;
            return(View());
        }