Пример #1
0
        public ActionResult Create([Bind(Include = "Id,ProductName,Price,ProductCode,AddedDate")] TopProduct topproduct)
        {
            if (ModelState.IsValid)
            {
                db.TopProducts.Add(topproduct);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(topproduct));
        }
        public ActionResult Create([Bind(Include = "CatId,CategoryName,ProductName,Price,ProductCode,AddedDate")] Category category)
        {
            if (ModelState.IsValid)
            {
                db.Categories.Add(category);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(category));
        }
Пример #3
0
 public ActionResult Order(Order order)
 {
     using (ShopDbEntities7 entities = new ShopDbEntities7())
     {
         entities.Orders.Add(order);
         entities.SaveChanges();
         int id = order.Id;
     }
     return(View("Succss"));
 }