public ActionResult DeleteConfirmed(int id) { WebUI.DBEntities.Type type = db.Types.Find(id); db.Types.Remove(type); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Name,Count,ArmyId")] WebUI.DBEntities.Type type) { if (ModelState.IsValid) { db.Entry(type).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ArmyId = new SelectList(db.Armys, "Id", "Name", type.ArmyId); return(View(type)); }
// GET: Types/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WebUI.DBEntities.Type type = db.Types.Find(id); if (type == null) { return(HttpNotFound()); } return(View(type)); }
// GET: Types/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WebUI.DBEntities.Type type = db.Types.Find(id); if (type == null) { return(HttpNotFound()); } ViewBag.ArmyId = new SelectList(db.Armys, "Id", "Name", type.ArmyId); return(View(type)); }
public ActionResult AddMore([Bind(Include = "Id,Name,Count,ArmyId")] WebUI.DBEntities.Type type, int number) { if (ModelState.IsValid) { for (int i = 0; i < number; i++) { db.Types.Add(type); db.SaveChanges(); } return(RedirectToAction("Index")); } ViewBag.ArmyId = new SelectList(db.Armys, "Id", "Name", type.ArmyId); return(View(type)); }