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(); } }
public void Add(Product product) { using (OnlineShoppingDB_Context context = new OnlineShoppingDB_Context()) { context.Entry(product).State = EntityState.Added; context.SaveChanges(); } }
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(); } }
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); }