Пример #1
0
        public ActionResult Create(ProductTab producttab)
        {
            if (ModelState.IsValid)
            {
                db.ProductsTabs.Add(producttab);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.ProductId = new SelectList(db.Products, "Id", "Name", producttab.ProductId);
            ViewBag.TabId = new SelectList(db.Tabs, "Id", "Code", producttab.TabId);
            return View(producttab);
        }
Пример #2
0
 public ActionResult Edit(ProductTab producttab)
 {
     if (ModelState.IsValid)
     {
         db.Entry(producttab).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.ProductId = new SelectList(db.Products, "Id", "Name", producttab.ProductId);
     ViewBag.TabId = new SelectList(db.Tabs, "Id", "Code", producttab.TabId);
     return View(producttab);
 }