Example #1
0
        public ActionResult Create(Port port)
        {
            if (ModelState.IsValid)
            {
                db.Ports.Add(port);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.NetworkSwitchID = new SelectList(db.NetworkSwitchs, "NetworkSwitchID", "NetworkSwitchName", port.NetworkSwitchID);
            ViewBag.NICID = new SelectList(db.NICs, "NICID", "NicName", port.NICID);
            return View(port);
        }
Example #2
0
 public ActionResult Edit(Port port)
 {
     if (ModelState.IsValid)
     {
         db.Entry(port).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.NetworkSwitchID = new SelectList(db.NetworkSwitchs, "NetworkSwitchID", "NetworkSwitchName", port.NetworkSwitchID);
     ViewBag.NICID = new SelectList(db.NICs, "NICID", "NicName", port.NICID);
     return View(port);
 }