コード例 #1
0
 public void SaveNewOrder(Order order)   //, int customerId
 {
     using (var context = new GlassContext())
     {
         context.OrderSet.Add(order);
         context.SaveChanges();
     }
 }
コード例 #2
0
 public void SaveUpdatedGlass(Glass glass)
 {
     using (var context = new GlassContext())
     {
         context.Entry(glass).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
コード例 #3
0
 public void SaveUpdatedOrder(Order order)
 {
     using (var context = new GlassContext())
     {
         context.Entry(order).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
コード例 #4
0
 public void SaveNewCustomer(Customer customer)
 {
     using (var context = new GlassContext())
     {
         context.CustomerSet.Add(customer);
         context.SaveChanges();
     }
 }
コード例 #5
0
 public void SaveUpdatedCustomer(Customer customer)
 {
     using (var context = new GlassContext())
     {
         context.Entry(customer).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
コード例 #6
0
 public void SaveNewGlass(Glass glass)
 {
     using (var context = new GlassContext())
     {
         context.GlassSet.Add(glass);
         context.SaveChanges();
     }
 }
コード例 #7
0
        //public Order GetOrderById(int id)
        //{
        //    using (var context = new GlassContext())
        //    {
        //        Order order = context.OrderSet.Find(id);
        //        Customer customer = GetCustomerById(order.CustomerId);
        //        order.Customer = customer;
        //        return order;
        //    }
        //}

        public void DeleteOrder(int orderId)
        {
            using (var context = new GlassContext())
            {
                var order = context.OrderSet.Find(orderId);
                context.Entry(order).State = EntityState.Deleted;
                context.SaveChanges();
            }
        }
コード例 #8
0
 public void DeleteCustomer(int customerId)
 {
     using (var context = new GlassContext())
     {
         var customer = context.CustomerSet.Find(customerId);
         context.Entry(customer).State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
コード例 #9
0
 public void DeleteGlass(int glassId)
 {
     using (var context = new GlassContext())
     {
         var glass = context.GlassSet.Find(glassId);
         context.Entry(glass).State = EntityState.Deleted;
         context.SaveChanges();
     }
 }