//********************Update category public void UpdateCategory(Category category) { using (var context = new FAContext()) { context.Entry(category).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
//********************Update Products public void UpdateProduct(Product Product) { using (var context = new FAContext()) { context.Entry(Product).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public object UpdateOrderStatus(int ID, string status) { using (var context = new FAContext()) { var order = context.Orders.Find(ID); order.status = status; context.Entry(order).State = EntityState.Modified; return(context.SaveChanges() > 0); } }
//********************Save Products public void SaveProduct(Product Product) { using (var context = new FAContext()) { context.Entry(Product.Category).State = System.Data.Entity.EntityState.Unchanged; context.Products.Add(Product); context.SaveChanges(); } }