Exemplo n.º 1
0
    public static TomOrder GetTomOrder(int id)
    {
        DBEntities db = new DBEntities();

        TomOrder o = db.TomOrders.SingleOrDefault(order => order.OID == id);

        return(o);
    }
Exemplo n.º 2
0
    public static void UpdateTomOrder(TomOrder order)
    {
        DBEntities db = new DBEntities();

        db.Entry(order).State = System.Data.Entity.EntityState.Modified;

        db.SaveChanges();
    }
Exemplo n.º 3
0
    public static void AddTomOrder(TomOrder order)
    {
        DBEntities db = new DBEntities();

        db.TomOrders.Add(order);

        db.SaveChanges();
    }
Exemplo n.º 4
0
    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();
    }