public async Task <ActionResult> DeleteConfirmed(int id) { AlchemyCard alchemyCard = await _db.AlchemyCards.FindAsync(id); _db.AlchemyCards.Remove(alchemyCard); await _db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Element,Name,VictoryPoints,Rank,Costs")] AlchemyCard alchemyCard) { if (ModelState.IsValid) { _db.Entry(alchemyCard).State = EntityState.Modified; await _db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.Element = new SelectList(_db.AlchemyElements, "Id", "Name", alchemyCard.Element); ViewBag.Rank = new SelectList(_db.AlchemyRanks, "Id", "Name", alchemyCard.Rank); return(View(alchemyCard)); }
// GET: AlchemyCards/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(RedirectToAction("Index")); } AlchemyCard alchemyCard = await _db.AlchemyCards.FindAsync(id); if (alchemyCard == null) { return(HttpNotFound()); } return(View(alchemyCard)); }
// GET: AlchemyCards/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(RedirectToAction("Index")); } AlchemyCard alchemyCard = await _db.AlchemyCards.FindAsync(id); if (alchemyCard == null) { return(HttpNotFound()); } ViewBag.Element = new SelectList(_db.AlchemyElements, "Id", "Name", alchemyCard.Element); ViewBag.Rank = new SelectList(_db.AlchemyRanks, "Id", "Name", alchemyCard.Rank); return(View(alchemyCard)); }