/* -------------------------------------------------------------------------------------- */ public ActionResult boletasportorneo(string accion) { var ltorneos = new torneomodels().listatorneos(); ViewData["listatorneos"] = ltorneos; torneomodels T = new torneomodels(); return View(T); }
/* -------------------------------------------------------------------------------------- */ public ActionResult boletaporfecha(String accion) { var ltorneos = new torneomodels().listatorneos(); ViewData["listatorneos"] = ltorneos; fechamodels F = new fechamodels(); return View(F); }
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(); }
/* -------------------------------------------------------------------------------------- */ public ActionResult Agregar() { var ltorneos = new torneomodels().listatorneos(); ViewData["listatorneos"] = ltorneos; return View(); }
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(); }
/* -------------------------------------------------------------------------------------- */ 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"); } }
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(); } }
public ActionResult boletasportorneo(string accion, torneomodels T) { var ltorneos = new torneomodels().listatorneos(); ViewData["listatorneos"] = ltorneos; return RedirectToAction(accion, new { idtorneo = T.id }); }
public ActionResult boletaporfecha(String accion, fechamodels F) { var ltorneos = new torneomodels().listatorneos(); ViewData["listatorneos"] = ltorneos; return RedirectToAction(accion, new { idf = F.id }); }
/* -------------------------------------------------------------------------------------- */ 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"); }
/* -------------------------------------------------------------------------------------- */ public ActionResult Ver(int id) { var torneo = new torneomodels().vertorneo(id).First(); @ViewBag.id = torneo.id; @ViewBag.nombre = torneo.nombre; return View(); }
/* -------------------------------------------------------------------------------------- */ 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; }
/* -------------------------------------------------------------------------------------- */ public ActionResult Index() { var listatorneos = new torneomodels().listatorneos(); return View(listatorneos); }
/* -------------------------------------------------------------------------------------- */ public ActionResult Seleccionartorneo() { var ltorneos = new torneomodels().listatorneos(); ViewData["listatorneos"] = ltorneos; torneomodels T = new torneomodels(); return View(T); }
/* -------------------------------------------------------------------------------------- */ public ActionResult Seleccionarfechaportorneo() { var ltorneos = new torneomodels().listatorneos(); ViewData["listatorneos"] = ltorneos; fechamodels F = new fechamodels(); return View(F); }