Esempio n. 1
0
        public ActionResult Create(Server server)
        {
            if (ModelState.IsValid)
            {
                db.Servers.Add(server);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.InfrastructureID = new SelectList(db.Infrastructures, "InfrastructureID", "InfrastructureName", server.InfrastructureID);
            ViewBag.DepartmentID = new SelectList(db.Departments, "DepartmentID", "DepartmentName", server.DepartmentID);
            return View(server);
        }
Esempio n. 2
0
 public ActionResult Edit(Server server)
 {
     if (ModelState.IsValid)
     {
         db.Entry(server).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.InfrastructureID = new SelectList(db.Infrastructures, "InfrastructureID", "InfrastructureName", server.InfrastructureID);
     ViewBag.DepartmentID = new SelectList(db.Departments, "DepartmentID", "DepartmentName", server.DepartmentID);
     return View(server);
 }