Exemple #1
0
        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);
        }
Exemple #2
0
 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);
 }