public void UpdateCategory(Category category) { using (var context = new GPSContext()) { context.Entry(category).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public void Update(TEntity obj) { using (var ctx = new GPSContext()) { ctx.Entry(obj).State = System.Data.Entity.EntityState.Modified; ctx.SaveChanges(); } }
public void UpdateProduct(Product Product) { using (var context = new GPSContext()) { context.Entry(Product).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public void SaveProduct(Product Product) { using (var context = new GPSContext()) { context.Entry(Product.Category).State = System.Data.Entity.EntityState.Unchanged; context.Products.Add(Product); context.SaveChanges(); } }
public bool UpdateOrderStatus(int ID, string status) { using (var context = new GPSContext()) { var order = context.Orders.Find(ID); order.Status = status; context.Entry(order).State = EntityState.Modified; return(context.SaveChanges() > 0); } }