Beispiel #1
0
 /* --------------------------------------------------------------------------------------  */
 public ActionResult boletaporfecha(String accion)
 {
     var ltorneos = new torneomodels().listatorneos();
     ViewData["listatorneos"] = ltorneos;
     fechamodels F = new fechamodels();
     return View(F);
 }
Beispiel #2
0
        public ActionResult Agregar(fechamodels model)
        {
            var ltorneos = new torneomodels().listatorneos();
            ViewData["listatorneos"] = ltorneos;

            if (ModelState.IsValid)
            {

                MvcApplication6.Models.fecha F = new MvcApplication6.Models.fecha
                {
                    idtorneo = model.idtorneo,
                    nombre = model.nombre,
                    fecha1 = model.fecha1,
                };

                db.fechas.InsertOnSubmit(F);
                try
                {
                    db.SubmitChanges();
                }
                catch
                {
                    TempData["ERROR"] = "No se pudo agregar la fecha, por favor intente nuevamente.";
                    return View();

                }
                TempData["MENSAJE"] = "Se agrego correctamente la fecha.";
                return RedirectToAction("Index");
            }
            TempData["ERROR"] = "Error en el alta de la fecha. Modelo Invalido";
            return View();
        }
Beispiel #3
0
        /* --------------------------------------------------------------------------------------  */
        public ActionResult Agregar()
        {
            var lfechas = new fechamodels().listafechas();
            ViewData["listafechas"] = lfechas;

            var lequipos = new equipomodels().listaequipos();
            ViewData["listaequipos"] = lequipos;

            return View();
        }
Beispiel #4
0
        public ActionResult Agregar(partidomodels model)
        {
            var lfechas = new fechamodels().listafechas();
            ViewData["listafechas"] = lfechas;

            var lequipos = new equipomodels().listaequipos();
            ViewData["listaequipos"] = lequipos;

            if (ModelState.IsValid)
            {
                if (model.equipolocal != model.equipovisita)
                {
                    MvcApplication6.Models.partido F = new MvcApplication6.Models.partido
                    {
                        id = model.id,
                        idfechatorneo = model.idfechatorneo,
                        equipolocal = model.equipolocal,
                        equipovisita = model.equipovisita,
                        goleslocal = 0,
                        golesvisita = 0,
                        estadio = model.estadio,
                    };

                    db.partidos.InsertOnSubmit(F);

                    try
                    {
                        db.SubmitChanges();
                    }
                    catch
                    {
                        TempData["ERROR"] = "No se pudo agregar el partido, por favor intente nuevamente.";
                        return View();
                    }

                    TempData["MENSAJE"] = "Se agrego correctamente el partido.";
                    return RedirectToAction("Index");
                }
                else
                {
                    TempData["ERROR"] = "Error en el alta del partido, los equipos deben ser distintos, por favor intente nuevamente.";
                    return View();

                }
            }
            else
            {
                TempData["ERROR"] = "Error en el alta del partido, por favor intente nuevamente.";
            }

             return View();
        }
Beispiel #5
0
 /* --------------------------------------------------------------------------------------  */
 public ActionResult Editar(int id)
 {
     MvcApplication6.Models.fecha T = new MvcApplication6.Models.fecha();
     try
     {
         T = db.fechas.Single(q => q.id == id);
         MvcApplication6.Models.fechamodels fmodel = new MvcApplication6.Models.fechamodels();
         fmodel.id       = T.id;
         fmodel.idtorneo = T.idtorneo;
         fmodel.nombre   = T.nombre;
         fmodel.fecha1 = T.fecha1;
         return View(fmodel);
     }
     catch
     {
         TempData["ERROR"] = "No se pudo editar la fecha, por favor intente nuevamente.";
         return RedirectToAction("Index");
     }
 }
Beispiel #6
0
 public ActionResult boletaporfecha(String accion, fechamodels F)
 {
     var ltorneos = new torneomodels().listatorneos();
     ViewData["listatorneos"] = ltorneos;
     return RedirectToAction(accion, new { idf = F.id });
 }
Beispiel #7
0
 public JsonResult getboletasportorneo(int idb)
 {
     var lfechas = new fechamodels().listafechasportorneo(idb);
     return Json(lfechas, JsonRequestBehavior.AllowGet);
 }
Beispiel #8
0
 public ActionResult Editar(int id, fechamodels model)
 {
     try
     {
         if (this.SaveFecha(model))
         {
             TempData["MENSAJE"] = "Se edito correctamente la fecha.";
             return RedirectToAction("Index");
         }
         else
         {
             TempData["ERROR"] = "No se pudo editar la fecha, por favor intente nuevamente.";
             return View();
         }
     }
     catch
     {
         TempData["ERROR"] = "No se pudo editar la fecha, por favor intente nuevamente.";
         return View();
     }
 }
Beispiel #9
0
 /* --------------------------------------------------------------------------------------  */
 public ActionResult Ver(int id)
 {
     var fecha = new fechamodels().verfecha(id).First();
     @ViewBag.id = fecha.id;
     @ViewBag.idtorneo = fecha.idtorneo;
     @ViewBag.nombre     = fecha.nombre;
     @ViewBag.fecha       = fecha.fecha1;
     return View();
 }
Beispiel #10
0
 /* --------------------------------------------------------------------------------------  */
 public bool SaveFecha(fechamodels model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             fecha T = new fecha();
             T = db.fechas.Single(q => q.id == model.id);
             T.nombre    = model.nombre;
             T.idtorneo  = model.idtorneo;
             T.nombre    = model.nombre;
             T.fecha1    = model.fecha1;
             db.SubmitChanges();
             return true;
         }
         catch
         {
             return false;
         }
     }
     return false;
 }
Beispiel #11
0
 /* --------------------------------------------------------------------------------------  */
 public ActionResult Index()
 {
     var lfechas = new fechamodels().listafechas();
     return View(lfechas);
 }
Beispiel #12
0
 /* --------------------------------------------------------------------------------------  */
 public ActionResult Eliminar(int id)
 {
     var aux = new fechamodels().verfecha(id).First();
     MvcApplication6.Models.fecha F = new fecha
     {
         id      = aux.id,
         idtorneo=aux.idtorneo,
         nombre  =aux.nombre,
         fecha1  =aux.fecha1,
     };
     try
     {
         db.fechas.Attach(F);
         db.fechas.DeleteOnSubmit(F);
         db.SubmitChanges();
         TempData["MENSAJE"] = "Se elimino correctamente la fecha.";
     }
     catch
     {
         TempData["ERROR"] = "No se pudo eliminar la fecha, por favor intente nuevamente.";
     }
     return RedirectToAction("Index");
 }
Beispiel #13
0
        /* --------------------------------------------------------------------------------------  */
        public ActionResult Editar(int idp)
        {
            MvcApplication6.Models.partido T = new MvcApplication6.Models.partido();

            var lfechas = new fechamodels().listafechas();
            ViewData["listafechas"] = lfechas;

            var lequipos = new equipomodels().listaequipos();
            ViewData["listaequipos"] = lequipos;

            try
            {
                T = db.partidos.Single(q => q.id == idp);
                MvcApplication6.Models.partidomodels pmodel = new MvcApplication6.Models.partidomodels();
                pmodel.id           =T.id;
                pmodel.equipolocal  =T.equipolocal;
                pmodel.equipovisita =T.equipovisita;
                pmodel.goleslocal   =T.goleslocal;
                pmodel.golesvisita  =T.golesvisita;
                pmodel.idfechatorneo=T.idfechatorneo;
                pmodel.estadio = T.estadio;
                return View(pmodel);
            }
            catch
            {
                TempData["ERROR"] = "No se pudo editar el partido, por favor intente nuevamente.";
                return RedirectToAction("Index");
            }
        }
Beispiel #14
0
        public ActionResult Editar(int idp, partidomodels model)
        {
            var lfechas = new fechamodels().listafechas();
            ViewData["listafechas"] = lfechas;

            var lequipos = new equipomodels().listaequipos();
            ViewData["listaequipos"] = lequipos;

            try
            {
                if (this.SavePartido(model))
                {
                    TempData["MENSAJE"] = "Se edito correctamente el partido.";
                    return RedirectToAction("Index");
                }
                else
                {
                    TempData["ERROR"] = "No se pudo editar el partido, por favor intente nuevamente.";
                    return View();
                }
            }
            catch
            {
                TempData["ERROR"] = "No se pudo editar el partido, por favor intente nuevamente.";
                return View();
            }
        }
Beispiel #15
0
 /* --------------------------------------------------------------------------------------  */
 public ActionResult Seleccionarfechaportorneo()
 {
     var ltorneos = new torneomodels().listatorneos();
     ViewData["listatorneos"] = ltorneos;
     fechamodels F = new fechamodels();
     return View(F);
 }