Exemplo n.º 1
0
        public ActionResult Create(Software software)
        {
            if (ModelState.IsValid)
            {
                db.Softwares.Add(software);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.VendorID = new SelectList(db.Vendors, "VendorID", "VendorName", software.VendorID);
            ViewBag.SoftwareLicenseID = new SelectList(db.SoftwareLicenses, "SoftwareLicenseID", "SoftwareLicenseID", software.SoftwareLicenseID);
            return View(software);
        }
Exemplo n.º 2
0
 public ActionResult Edit(Software software)
 {
     if (ModelState.IsValid)
     {
         db.Entry(software).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.VendorID = new SelectList(db.Vendors, "VendorID", "VendorName", software.VendorID);
     ViewBag.SoftwareLicenseID = new SelectList(db.SoftwareLicenses, "SoftwareLicenseID", "SoftwareLicenseID", software.SoftwareLicenseID);
     return View(software);
 }