Exemple #1
0
        public ActionResult EliminarEdit(int?id)
        {
            if (Request.Cookies["RolCookie"] == null)
            {
                return(RedirectToAction("Login", "Registro"));
            }
            else
            {
                var idC = Request.Cookies["RolCookie"].Value;
                var c   = new HttpCookie("RolCookie");
                c.Value   = idC;
                c.Expires = DateTime.Now.AddMinutes(15);
                Response.Cookies.Add(c);
            }

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            tbl_Jugadores Jugador = db.tbl_Jugadores.Find(id);

            if (Jugador == null)
            {
                return(HttpNotFound());
            }

            return(View(Jugador));
        }
Exemple #2
0
        public ActionResult DeleteConfirmedEdit(int id)
        {
            if (Request.Cookies["RolCookie"] == null)
            {
                return(RedirectToAction("Login", "Registro"));
            }
            else
            {
                var idC = Request.Cookies["RolCookie"].Value;
                var c   = new HttpCookie("RolCookie");
                c.Value   = idC;
                c.Expires = DateTime.Now.AddMinutes(15);
                Response.Cookies.Add(c);
            }

            try
            {
                var idS = Session["IdSalon"];
                var JugadorSalonView = Session["JugadorSalonView"] as JugadoresSalonesView;

                tbl_Jugadores tbl_Jugadores = JugadorSalonView.Jugadores.Find(p => p.Id == id);
                JugadorSalonView.Jugadores.Remove(tbl_Jugadores);
                var listC = db.tbl_Salones.ToList().Where(x => x.IdAdministrador == Convert.ToInt32(Request.Cookies["RolCookie"].Value));
                ViewBag.IdSalon = new SelectList(listC, "Id", "Id", idS);

                return(View("EditarSalon", JugadorSalonView));
            }
            catch (Exception ex)
            {
            }

            return(RedirectToAction("Index"));
        }
Exemple #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            tbl_Jugadores tbl_Jugadores = db.tbl_Jugadores.Find(id);

            db.tbl_Jugadores.Remove(tbl_Jugadores);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #4
0
 public ActionResult Edit([Bind(Include = "Id,Nombres,Apellidos,Usuario,Password,Genero,Correo,FechaNacimiento")] tbl_Jugadores tbl_Jugadores)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tbl_Jugadores).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tbl_Jugadores));
 }
Exemple #5
0
        public ActionResult Create([Bind(Include = "Id,Nombres,Apellidos,Usuario,Password,Genero,Correo,FechaNacimiento")] tbl_Jugadores tbl_Jugadores)
        {
            if (ModelState.IsValid)
            {
                db.tbl_Jugadores.Add(tbl_Jugadores);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tbl_Jugadores));
        }
Exemple #6
0
        public ActionResult AgregarJugador(tbl_Jugadores jugadores)
        {
            if (Request.Cookies["RolCookie"] == null)
            {
                return(RedirectToAction("Login", "Registro"));
            }
            else
            {
                var idC = Request.Cookies["RolCookie"].Value;
                var c   = new HttpCookie("RolCookie");
                c.Value   = idC;
                c.Expires = DateTime.Now.AddMinutes(15);
                Response.Cookies.Add(c);
            }

            var JugadorSalonView = Session["JugadorSalonView"] as JugadoresSalonesView;

            var IDJugador = int.Parse(Request["Id"]);

            if (IDJugador == 0)
            {
                var ListPre = db.tbl_Jugadores.ToList();
                ListPre       = ListPre.OrderBy(c => c.Nombres).ToList();
                ViewBag.Id    = new SelectList(ListPre, "Id", "FullName");
                ViewBag.Error = "Debe seleccionar Jugador";
                return(View(jugadores));
            }
            var Jugador = db.tbl_Jugadores.Find(IDJugador);

            tbl_Jugadores JugadorE = JugadorSalonView.Jugadores.Find(p => p.Id == IDJugador);

            if (JugadorE == null)
            {
                var tbl_Jugadores = new tbl_Jugadores
                {
                    Id        = int.Parse(Request["Id"]),
                    Nombres   = Jugador.Nombres,
                    Apellidos = jugadores.Apellidos
                };
                JugadorSalonView.Jugadores.Add(tbl_Jugadores);
            }

            var ListPre2 = db.tbl_Jugadores.ToList();

            ListPre2   = ListPre2.OrderBy(c => c.Nombres).ToList();
            ViewBag.Id = new SelectList(ListPre2, "Id", "FullName");

            var listC = db.tbl_Salones.ToList().Where(x => x.IdAdministrador == Convert.ToInt32(Request.Cookies["RolCookie"].Value));

            ViewBag.IdSalon = new SelectList(listC, "Id", "Id");

            return(View("Agregar", JugadorSalonView));
        }
Exemple #7
0
        // GET: Jugadores/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tbl_Jugadores tbl_Jugadores = db.tbl_Jugadores.Find(id);

            if (tbl_Jugadores == null)
            {
                return(HttpNotFound());
            }
            return(View(tbl_Jugadores));
        }