// GET: SuperHero/Details/5 public ActionResult Details(int id) { { SuperHeroe superhero = context.SuperHeroeCharacters.Where(i => i.Id == id).Single(); return(View(superhero)); } }
static void Main(string[] args) { SuperHeroe Heroe = new SuperHeroe("IronMan", 1963, "Tales of Suspense", 100, new SuperPoder(), 2); Villano Villano = new Villano("Venom", 1984, "The Amazing Spiderman", 100); Combate Combate = new Combate(Heroe, Villano, 1); }
// GET: SuperHero/Delete/5 (DONE) public ActionResult Delete(int id) { { SuperHeroe superhero = context.SuperHeroeCharacters.Find(id); if (superhero == null) { return(HttpNotFound()); } return(View(superhero)); } }
// GET: SuperHero/Edit/5 (DONE) public ActionResult Edit(int id) { { //Superhero superhero = context.Superheroes.Where(i => i.Id == id).FirstOrDefault(); SuperHeroe superhero = context.SuperHeroeCharacters.Find(id); if (superhero == null) { return(HttpNotFound()); } return(View(superhero)); } }
public ActionResult Create(SuperHeroe superheroe) { try { context.SuperHeroes.Add(superheroe); context.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Delete(int id, SuperHeroe superheroe) { try { var heroToRemove = context.SuperHeroes.Where(h => h.Id == superheroe.Id).Single(); context.SuperHeroes.Remove(heroToRemove); context.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(SuperHeroe superheroe) { try { SuperHeroe heroFromDb = context.SuperHeroes.Where(s => s.Id == superheroe.Id).First(); UpdateModel(heroFromDb); context.SaveChanges(); return(RedirectToAction("Details", new { id = heroFromDb.Id }));//goes back to the hero table (making a new object using the hero } catch { return(View()); } }
public ActionResult Create(SuperHeroe superHeroes) { try { // TODO: Add insert logic here context.SuperHeroeCharacters.Add(superHeroes); context.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Delete(int id, FormCollection collection) { try { // TODO: Add delete logic here SuperHeroe superhero = context.SuperHeroeCharacters.Find(id); context.SuperHeroeCharacters.Remove(superhero); context.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(int id, SuperHeroe superhero) { try { var supereheroInDb = context.SuperHeroeCharacters.Where(s => s.Id == superhero.Id).SingleOrDefault(); supereheroInDb.Name = superhero.Name; supereheroInDb.AlterEgo = superhero.AlterEgo; supereheroInDb.PrimaryAbility = superhero.PrimaryAbility; supereheroInDb.SecondaryAbility = superhero.SecondaryAbility; supereheroInDb.CatchPhrase = superhero.CatchPhrase; context.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View("Index")); } }
// GET: SuperHeroes/Edit/5 public ActionResult Edit(int id) { SuperHeroe superheroe = context.SuperHeroes.Where(s => s.Id == id).First(); return(View(superheroe)); }
// GET: SuperHeroes/Create public ActionResult Create() { SuperHeroe superheroe = new SuperHeroe(); return(View(superheroe)); }
public Combate() { this.Heroe = new SuperHeroe(); this.Villano = new Villano(); this.CantidadUsosSuperPoder = 0; }
public void SetHeroe(SuperHeroe heroe) { this.Heroe = new SuperHeroe(); }
public Combate(SuperHeroe heroe, Villano villano, int cantidadusospoder) { this.Heroe = heroe; this.Villano = villano; this.CantidadUsosSuperPoder = cantidadusospoder; }