public ActionResult Create(ServerSoftware serversoftware) { if (ModelState.IsValid) { db.ServerSoftwares.Add(serversoftware); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.ServerID = new SelectList(db.Servers, "ServerID", "ServerName", serversoftware.ServerID); ViewBag.SoftwareID = new SelectList(db.Softwares, "SoftwareID", "SotwareName", serversoftware.SoftwareID); return View(serversoftware); }
public ActionResult Edit(ServerSoftware serversoftware) { if (ModelState.IsValid) { db.Entry(serversoftware).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.ServerID = new SelectList(db.Servers, "ServerID", "ServerName", serversoftware.ServerID); ViewBag.SoftwareID = new SelectList(db.Softwares, "SoftwareID", "SotwareName", serversoftware.SoftwareID); return View(serversoftware); }