Esempio n. 1
0
 void IProductService.Delete(int ProductID)
 {
     using (var context = new DataBaseEntities(DBManager.EntityConnectionString))
     {
         Product oldProduct = context.Products.Where(i => i.ProductID == ProductID).First();
         context.DeleteObject(oldProduct);
         context.SaveChanges();
     }
 }
Esempio n. 2
0
 void IOrderService.Delete(int OrderID)
 {
     using (var context = new DataBaseEntities(DBManager.EntityConnectionString))
     {
         Order oldOrder = context.Orders.Where(i => i.OrderID == OrderID).First();
         context.DeleteObject(oldOrder);
         context.SaveChanges();
     }
 }
Esempio n. 3
0
 void IDeviceService.Delete(int DeviceId)
 {
     using (var context = new DataBaseEntities(DBManager.EntityConnectionString))
     {
         Device oldDevice = context.Devices.Where(i => i.DeviceID == DeviceId).First();
         context.DeleteObject(oldDevice);
         context.SaveChanges();
     }
 }
Esempio n. 4
0
        void ICustomerService.Delete(int CustomerID)
        {
            using (var context = new DataBaseEntities())
            {
                try
                {
                    Customer cust = context.Customers
                                    .Where(c => c.CustomerID == CustomerID)
                                    .FirstOrDefault();

                    context.DeleteObject(cust);
                    context.SaveChanges();
                }
                catch (Exception)
                {
                    throw new FaultException("Error deleting customer id#" + CustomerID);
                }
            }
        }