示例#1
0
 /* --------------------------------------------------------------------------------------  */
 public ActionResult boletasportorneo(string accion)
 {
     var ltorneos = new torneomodels().listatorneos();
     ViewData["listatorneos"] = ltorneos;
     torneomodels T = new torneomodels();
     return View(T);
 }
示例#2
0
 /* --------------------------------------------------------------------------------------  */
 public ActionResult boletaporfecha(String accion)
 {
     var ltorneos = new torneomodels().listatorneos();
     ViewData["listatorneos"] = ltorneos;
     fechamodels F = new fechamodels();
     return View(F);
 }
示例#3
0
        public ActionResult Agregar(torneomodels model)
        {
            if (ModelState.IsValid)
            {
                torneo T = new torneo
                {
                    nombre = model.nombre
                };

                db.torneos.InsertOnSubmit(T);
                try
                {
                    db.SubmitChanges();
                }
                catch
                {
                    TempData["ERROR"] = "No se pudo agregar el torneo, por favor intente nuevamente.";
                    return View();
                }
                TempData["MENSAJE"] = "Se agrego correctamente el torneo.";
                return RedirectToAction("Index");
            }
            TempData["ERROR"] = "Error en el alta del torneo.";
            return View();
        }
示例#4
0
        /* --------------------------------------------------------------------------------------  */
        public ActionResult Agregar()
        {
            var ltorneos = new torneomodels().listatorneos();
            ViewData["listatorneos"] = ltorneos;

            return View();
        }
示例#5
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();
        }
示例#6
0
 /* --------------------------------------------------------------------------------------  */
 public ActionResult Editar(int id)
 {
     torneo T = new torneo();
     try
     {
         T = db.torneos.Single(q => q.id == id);
         torneomodels tmodel = new torneomodels();
         tmodel.id       = T.id;
         tmodel.nombre   = T.nombre;
         return View(tmodel);
     }
     catch
     {
         TempData["ERROR"] = "No se pudo editar el torneo, por favor intente nuevamente.";
         return RedirectToAction("Index");
     }
 }
示例#7
0
 public ActionResult Editar(int id, torneomodels model)
 {
     try
     {
         if (this.SaveTorneo(model))
         {
             TempData["MENSAJE"] = "Se edito correctamente el torneo.";
             return RedirectToAction("Index");
         }
         else
         {
             TempData["ERROR"] = "No se pudo editar el torneo, por favor intente nuevamente.";
             return View();
         }
     }
     catch
     {
         TempData["ERROR"] = "No se pudo editar el torneo, por favor intente nuevamente.";
         return View();
     }
 }
示例#8
0
        public ActionResult boletasportorneo(string accion, torneomodels T)
        {
            var ltorneos = new torneomodels().listatorneos();
            ViewData["listatorneos"] = ltorneos;

            return RedirectToAction(accion, new { idtorneo = T.id });
        }
示例#9
0
 public ActionResult boletaporfecha(String accion, fechamodels F)
 {
     var ltorneos = new torneomodels().listatorneos();
     ViewData["listatorneos"] = ltorneos;
     return RedirectToAction(accion, new { idf = F.id });
 }
示例#10
0
 /* --------------------------------------------------------------------------------------  */
 public ActionResult Eliminar(int id)
 {
     var torneo1 = new torneomodels().vertorneo(id).First();
     torneo T = new torneo
     {
         id      =torneo1.id,
         nombre  =torneo1.nombre
     };
     try
     {
         db.torneos.Attach(T);
         db.torneos.DeleteOnSubmit(T);
         db.SubmitChanges();
         TempData["MENSAJE"] = "Se elimino correctamente el torneo.";
     }
     catch
     {
         TempData["ERROR"] = "No se pudo eliminar el torneo, por favor intente nuevamente.";
     }
     return RedirectToAction("Index");
 }
示例#11
0
 /* --------------------------------------------------------------------------------------  */
 public ActionResult Ver(int id)
 {
     var torneo = new torneomodels().vertorneo(id).First();
     @ViewBag.id     = torneo.id;
     @ViewBag.nombre = torneo.nombre;
     return View();
 }
示例#12
0
 /* --------------------------------------------------------------------------------------  */
 public bool SaveTorneo(torneomodels model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             torneo T = new torneo();
             T = db.torneos.Single(q => q.id == model.id);
             T.nombre = model.nombre;
             db.SubmitChanges();
             return true;
         }
         catch
         {
             return false;
         }
     }
     return false;
 }
示例#13
0
 /* --------------------------------------------------------------------------------------  */
 public ActionResult Index()
 {
     var listatorneos = new torneomodels().listatorneos();
     return View(listatorneos);
 }
示例#14
0
 /* --------------------------------------------------------------------------------------  */
 public ActionResult Seleccionartorneo()
 {
     var ltorneos = new torneomodels().listatorneos();
     ViewData["listatorneos"] = ltorneos;
     torneomodels  T = new torneomodels();
     return View(T);
 }
示例#15
0
 /* --------------------------------------------------------------------------------------  */
 public ActionResult Seleccionarfechaportorneo()
 {
     var ltorneos = new torneomodels().listatorneos();
     ViewData["listatorneos"] = ltorneos;
     fechamodels F = new fechamodels();
     return View(F);
 }