public bool InsertProduct(PRODUCTS newProduct)
 {
     using (OrderGraberDBEntities dbContext = new OrderGraberDBEntities())
     {
         dbContext.PRODUCTS.Add(newProduct);
         dbContext.SaveChanges();
     }
     return(true);
 }
 public bool InsertCustomer(CUSTOMERS newCustomer)
 {
     using (OrderGraberDBEntities dbContext = new OrderGraberDBEntities())
     {
         dbContext.CUSTOMERS.Add(newCustomer);
         dbContext.SaveChanges();
     }
     return(true);
 }
Example #3
0
 public bool InsertOrder(ORDERS newOrder)
 {
     using (OrderGraberDBEntities dbContext = new OrderGraberDBEntities())
     {
         dbContext.ORDERS.Add(newOrder);
         dbContext.SaveChanges();
     }
     return(true);
 }
Example #4
0
 public bool InsertOrderDetail(ORDERS_DETAIL newOrderDetail)
 {
     using (OrderGraberDBEntities dbContext = new OrderGraberDBEntities())
     {
         dbContext.ORDERS_DETAIL.Add(newOrderDetail);
         dbContext.SaveChanges();
     }
     return(true);
 }
        public bool DeleteProduct(int id)
        {
            bool result = false;

            using (OrderGraberDBEntities dbContext = new OrderGraberDBEntities())
            {
                var recordToDelete = dbContext.PRODUCTS.Find(id);
                dbContext.PRODUCTS.Remove(recordToDelete);
                dbContext.SaveChanges();
            }
            return(result);
        }
        public bool DeleteCustomer(int id)
        {
            bool result = false;

            using (OrderGraberDBEntities dbContext = new OrderGraberDBEntities())
            {
                var recordToDelete = dbContext.CUSTOMERS.Find(id);
                dbContext.CUSTOMERS.Remove(recordToDelete);
                dbContext.SaveChanges();
            }
            return(result);
        }
Example #7
0
        public bool DeleteOrderDetail(int id)
        {
            bool result = false;

            using (OrderGraberDBEntities dbContext = new OrderGraberDBEntities())
            {
                var recordToDelete = dbContext.ORDERS_DETAIL.Find(id);
                dbContext.ORDERS_DETAIL.Remove(recordToDelete);
                dbContext.SaveChanges();
            }
            return(result);
        }