public static void CustomerUpdate(CustomerDetails Customer)
 {
     using (OnlineShoppingDB_Context context = new OnlineShoppingDB_Context())
     {
         context.Entry(Customer).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
 public void Add(CustomerDetails customer)
 {
     using (OnlineShoppingDB_Context context = new OnlineShoppingDB_Context())
     {
         context.Entry(customer).State = EntityState.Added;
         context.SaveChanges();
     }
 }
Example #3
0
 public void Add(Product product)
 {
     using (OnlineShoppingDB_Context context = new OnlineShoppingDB_Context())
     {
         context.Entry(product).State = EntityState.Added;
         context.SaveChanges();
     }
 }
Example #4
0
 public static void ProductUpdate(Product product)
 {
     using (OnlineShoppingDB_Context context = new OnlineShoppingDB_Context())
     {
         //product = context.ProductDB.FirstOrDefault(prod => prod.productId == product.productId);
         context.Entry(product).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
 public void CategoryDelete(int categoryId)
 {
     using (OnlineShoppingDB_Context context = new OnlineShoppingDB_Context())
     {
         Category category = new Category();
         category = context.Categorys.Find(categoryId);
         context.Entry(category).State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
Example #6
0
 public void ProductDelete(Product product)
 {
     using (OnlineShoppingDB_Context context = new OnlineShoppingDB_Context())
     {
         product = context.Products.Find(product.ProductId);
         context.Entry(product).State = EntityState.Deleted;
         context.SaveChanges();
     }
     //context.ProductDB.Attach(product);
 }