public ActionResult Create([Bind(Include = "ID,Name,MetaTitle,Code,Image,MoreImages,Price,PromotionPrice,Quantity,CategoryProductID,CategoryID,Detail,Warranty,CreateDate,CreateBy,Status,TopHot,ViewCount,Link")] Product product)
        {
            if (ModelState.IsValid)
            {
                db.Products.Add(product);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(product));
        }
 public bool Insert(OrderDetail orderDetail)
 {
     try
     {
         db.OrderDetails.Add(orderDetail);
         db.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
 public long Insert(User entity)
 {
     db.Users.Add(entity);
     db.SaveChanges();
     return(entity.ID);
 }
Ejemplo n.º 4
0
 public long Insert(Product entity)
 {
     db.Products.Add(entity);
     db.SaveChanges();
     return(entity.ID);
 }
 public long Insert(Order order)
 {
     db.Orders.Add(order);
     db.SaveChanges();
     return(order.ID);
 }