public static TomOrder GetTomOrder(int id) { DBEntities db = new DBEntities(); TomOrder o = db.TomOrders.SingleOrDefault(order => order.OID == id); return(o); }
public static void UpdateTomOrder(TomOrder order) { DBEntities db = new DBEntities(); db.Entry(order).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); }
public static void AddTomOrder(TomOrder order) { DBEntities db = new DBEntities(); db.TomOrders.Add(order); db.SaveChanges(); }
public static void DeleteTomOrder(int id) { DBEntities db = new DBEntities(); TomOrder o = db.TomOrders.SingleOrDefault(TomOrder => TomOrder.OID == id); //var query = from prod in db.Products // where prod.Id == id // select prod; //Product p = query.SingleOrDefault(); db.TomOrders.Remove(o); db.SaveChanges(); }