public RedirectResult Edit( Pokemon pokemon ) { foreach (var b in db.Pokemons) if (b.Id == pokemon.Id) { if(pokemon.Name != null) b.Name = pokemon.Name; if (pokemon.Damage != 0) b.Damage = pokemon.Damage; if (pokemon.Health != 0) b.Health = pokemon.Health; if (pokemon.SpellName != null) b.SpellName = pokemon.SpellName; if (pokemon.SpellDetails != null) b.SpellDetails = pokemon.SpellDetails; if (pokemon.SpellColdown != 0) b.SpellColdown = pokemon.SpellColdown; if (pokemon.BestPhrase != null) b.BestPhrase = pokemon.BestPhrase; break; } db.SaveChanges(); return RedirectPermanent( "/Home/Index" ); }
public ActionResult Create( Pokemon pokemon ) { db.Pokemons.Add( pokemon ); db.SaveChanges(); return Index(); }