예제 #1
0
        public IActionResult SaveChanges(FavoritePokemon updatedName) //saves changes when user adds nickname to favorited pokemon
        {
            FavoritePokemon pokemonName = _pokemonContext.FavoritePokemon.Find(updatedName.Id);

            pokemonName.Nickname = updatedName.Nickname;

            _pokemonContext.Entry(pokemonName).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            _pokemonContext.Update(pokemonName);
            _pokemonContext.SaveChanges();

            return(RedirectToAction("Favorites"));
        }