public ActionResult Create(ArmorItem armoritem) { if (ModelState.IsValid) { db.ArmorItems.Add(armoritem); db.SaveChanges(); return RedirectToAction("Index"); } return View(armoritem); }
public void CsvCreate(ArmorItem armoritem) { if (ModelState.IsValid) { db.ArmorItems.Add(armoritem); db.SaveChanges(); ViewBag.ArmorMessage += "Armor item \"" + armoritem.Name + "\" successfully added."; } else { ViewBag.ArmorMessage += "Adding item \"" + armoritem.Name + "\" FAILED."; } }
public ActionResult Edit(ArmorItem armoritem) { if (ModelState.IsValid) { db.Entry(armoritem).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(armoritem); }