public ActionResult Create(Rack rack, string rackname) { if (ModelState.IsValid) { db.Racks.Add(rack); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.RoomID = new SelectList(db.Rooms, "RoomID", "RoomName", rack.RoomID); ViewBag.VendorID = new SelectList(db.Vendors, "VendorID", "VendorName", rack.VendorID); return View(rack); }
public ActionResult Edit(Rack rack) { if (ModelState.IsValid) { db.Entry(rack).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.RoomID = new SelectList(db.Rooms, "RoomID", "RoomName", rack.RoomID); ViewBag.VendorID = new SelectList(db.Vendors, "VendorID", "VendorName", rack.VendorID); return View(rack); }