Example #1
0
        public async Task <IActionResult> Edit(string id, [Bind("Region")] Regiones regiones)
        {
            if (id != regiones.Region)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(regiones);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RegionesExists(regiones.Region))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(regiones));
        }
        public async Task <IActionResult> Edit(int id, [Bind("PokeId,Nombre,Tipo1,Tipo2,Region,Move1,Move2,Move3,Move4,Foto")] Pokemon pokemon)
        {
            if (id != pokemon.PokeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pokemon);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PokemonExists(pokemon.PokeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Region"] = new SelectList(_context.Regiones, "RegId", "NombreR", pokemon.Region);
            ViewData["Tipo1"]  = new SelectList(_context.Tipos, "TiposId", "NombreT", pokemon.Tipo1);
            ViewData["Tipo2"]  = new SelectList(_context.Tipos, "TiposId", "NombreT", pokemon.Tipo2);
            return(View(pokemon));
        }
        public async Task <IActionResult> Edit(int id, [Bind("TiposId,NombreT")] Tipos tipos)
        {
            if (id != tipos.TiposId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tipos);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TiposExists(tipos.TiposId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tipos));
        }
Example #4
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,AuthoredBy,Body,DatePosted,SubTitle,Title")] HomeContent homeContent)
        {
            if (id != homeContent.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(homeContent);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HomeContentExists(homeContent.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(homeContent));
        }
Example #5
0
 public async Task <IActionResult> Editar(string nombre, Pokemon pokemon)
 {
     if (nombre != pokemon.Nombre)
     {
         return(NotFound());
     }
     if (ModelState.IsValid)
     {
         _contex.Update(pokemon);
         await _contex.SaveChangesAsync();
     }
     return(RedirectToAction("Index"));
 }