Пример #1
0
        public ActionResult Create(UsersViewModel usuario)
        //LO CREO CON USERVIEWMODEL POR EL ADDRESS, PORQUE LO ESTOY CREANDO PARA QUE LO PUEDAN VER
        //DESPUES EN EL EDIT
        {
            try
            {
                var userDB = new UsersModel();

                userDB.name            = usuario.name;
                userDB.age             = usuario.age;
                userDB.email           = usuario.email;
                userDB.sex             = usuario.sex;
                userDB.password        = usuario.password;
                userDB.cellphone       = usuario.cellphone;
                userDB.Id              = usuario.Id;
                userDB.country         = usuario.country;
                userDB.city            = usuario.city;
                userDB.addressStreet   = usuario.addressStreet;
                userDB.addressNumber1  = usuario.addressNumber1;
                userDB.addressNumber2  = usuario.addressNumber2;
                userDB.addressNumber3  = usuario.addressNumber3;
                userDB.addressLocation = usuario.addressLocation;
                userDB.address         = usuario.addressStreet + " " + usuario.addressNumber1 + " # " + usuario.addressNumber2 + " - " + usuario.addressNumber3 + " " + usuario.addressLocation;
                //TODO: Add insert logic here
                _context.Usuarios.Add(userDB);
                _context.SaveChanges();

                return(RedirectToAction("Index", "Convoca"));
                //return RedirectToAction(nameof(Index));
            }
            catch
            {
                return(View());
            }
        }
Пример #2
0
        public ActionResult Create(EventsModel evento)
        {
            try
            {
                var eventoVM = new EventsModel();

                eventoVM.category = evento.category;
                eventoVM.sex      = evento.sex;
                eventoVM.reserve  = evento.reserve;
                eventoVM.date     = evento.date;
                eventoVM.cost     = evento.cost;
                eventoVM.paymment = evento.paymment;
                eventoVM.hour     = evento.hour;
                eventoVM.minute   = evento.minute;
                eventoVM.meridian = evento.meridian;
                eventoVM.Id       = evento.Id;

                eventoVM.place_id = evento.place_id;
                eventoVM.sport_id = evento.sport_id;

                eventoVM.time = evento.hour + " : " + evento.minute + " - " + evento.meridian;


                // TODO: Add insert logic here
                _context.Eventos.Add(eventoVM);
                _context.SaveChanges();

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
Пример #3
0
        public IActionResult Create(PlacesViewModel lugar)
        {
            try
            {
                var lugarDB = new PlacesModel();

                lugarDB.name            = lugar.name;
                lugarDB.email           = lugar.email;
                lugarDB.cellphone       = lugar.cellphone;
                lugarDB.Id              = lugar.Id;
                lugarDB.addressStreet   = lugar.addressStreet;
                lugarDB.addressNumber1  = lugar.addressNumber1;
                lugarDB.addressNumber2  = lugar.addressNumber2;
                lugarDB.addressNumber3  = lugar.addressNumber3;
                lugarDB.addressLocation = lugar.addressLocation;
                lugarDB.address         = lugar.addressStreet + " " + lugar.addressNumber1 + " # " + lugar.addressNumber2 + " - " + lugar.addressNumber3 + " " + lugar.addressLocation;
                //TODO: Add insert logic here
                _context.Lugares.Add(lugarDB);
                _context.SaveChanges();

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
        //[ValidateAntiForgeryToken]

        public JsonResult Create(ConvocadosModel convocados)
        //public IActionResult Create(ConvocadosModel convocados)
        {
            var dataLogin = new loginOkModel();

            try
            {
                var convocadosEvento = new ConvocadosModel();

                convocadosEvento.event_id = convocados.Id;

                var UserIdLogueado = User.Claims.FirstOrDefault(c => c.Type == "UserId");

                var UserIdLogueado1 = Convert.ToInt32(UserIdLogueado.Value);

                convocadosEvento.user_id = UserIdLogueado1;

                // TODO: Add insert logic here
                _context.Convocados.Add(convocadosEvento);
                _context.SaveChanges();

                dataLogin.ok = true;
                //return RedirectToAction(nameof(Index));
                ////return RedirectToAction("Index", "Events", new { id = "AllEvents" });
            }
            catch
            {
                dataLogin.ok = false;
                //return View();
            }
            return(Json(dataLogin));
            //return RedirectToAction("Index", "Events", new { id = "AllEvents" });
        }
Пример #5
0
        public IActionResult Create(SportsModel deporte)
        {
            try
            {
                // TODO: Add insert logic here
                _context.Deportes.Add(deporte);
                _context.SaveChanges();

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
Пример #6
0
        public ActionResult Edit(int id, CuentaModel datosUpdate)
        {
            try
            {
                var userDB = _context.Usuarios.Find(id);

                if (userDB != null)
                {
                    userDB.name            = datosUpdate.name;
                    userDB.age             = datosUpdate.age;
                    userDB.email           = datosUpdate.email;
                    userDB.sex             = datosUpdate.sex;
                    userDB.password        = datosUpdate.password;
                    userDB.cellphone       = datosUpdate.cellphone;
                    userDB.Id              = datosUpdate.Id;
                    userDB.country         = datosUpdate.country;
                    userDB.city            = datosUpdate.city;
                    userDB.addressStreet   = datosUpdate.addressStreet;
                    userDB.addressNumber1  = datosUpdate.addressNumber1;
                    userDB.addressNumber2  = datosUpdate.addressNumber2;
                    userDB.addressNumber3  = datosUpdate.addressNumber3;
                    userDB.addressLocation = datosUpdate.addressLocation;
                    datosUpdate.address    = datosUpdate.addressStreet + " " + datosUpdate.addressNumber1 + " # " + datosUpdate.addressNumber2 + " - " + datosUpdate.addressNumber3 + " " + datosUpdate.addressLocation;
                    //userDB.address = userDB.addressStreet + " " + userDB.addressNumber1 + " # " + userDB.addressNumber2 + " - " + userDB.addressNumber3 + " " + userDB.addressLocation;
                    userDB.address = datosUpdate.address;

                    // TODO: Add insert logic here
                    //_context.Usuarios.Add(userDB);
                    _context.SaveChanges();

                    return(RedirectToAction(nameof(Index)));
                }
                else
                {
                    return(NotFound());
                }
            }
            catch
            {
                return(View());
            }
        }