Exemple #1
0
 public void UpdateCategory(Category category)
 {
     using (var context = new ClothMarketContext())
     {
         context.Entry(category).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
 public void UpdateProduct(Product product)
 {
     using (var context = new ClothMarketContext())
     {
         context.Entry(product).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
        public void SaveProduct(Product product)
        {
            using (var context = new ClothMarketContext())
            {
                context.Entry(product.Category).State = System.Data.Entity.EntityState.Unchanged;

                context.Products.Add(product);
                context.SaveChanges();
            }
        }
Exemple #4
0
        public bool UpdateOrderStatus(int ID, string status)
        {
            using (var context = new ClothMarketContext())
            {
                var order = context.Orders.Find(ID);

                order.Status = status;

                context.Entry(order).State = EntityState.Modified;

                return(context.SaveChanges() > 0);
            }
        }