public ActionResult BudCreate(Building item) { if (ModelState.IsValid) { Database.Buildings.Add(item); Database.SaveChanges(); return RedirectToAction("UnitCreate", "Home", new { buildID = item.buildID, numOfUnits = item.buildNumUnits, addr = item.buildAddress }); } else return View("BudEdit", item); }
public ActionResult BudEdit(int id, Building item) { if (ModelState.IsValid) { var dbItem = Database.Buildings.Find(id); TryUpdateModel(dbItem); Database.SaveChanges(); return RedirectToAction("Building"); } else return View(item); }
public ActionResult BudCreate() { var model = new Building(); return View("BudEdit", model); }