Пример #1
0
        public ActionResult Create(Product product)
        {
            PharmaTest_NREntities entities = new PharmaTest_NREntities();

            entities.Products.Add(product);
            entities.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
        public ActionResult Edit(Product product)
        {
            PharmaTest_NREntities entities = new PharmaTest_NREntities();

            if (ModelState.IsValid)
            {
                entities.Entry(product).State = EntityState.Modified;
                entities.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(product));
        }