예제 #1
0
 public Order[] GetAllOrders()
 {
     using (var context = new DataBaseService().DataBaseContext)
     {
         return(context.Orders.ToArray());
     }
 }
예제 #2
0
 public void AddOrder(Order order)
 {
     using (var context = new DataBaseService().DataBaseContext)
     {
         context.Orders.Add(order);
         context.SaveChanges();
     }
 }
예제 #3
0
        public void SaveOrder(Order savedOrder)
        {
            using (var context = new DataBaseService().DataBaseContext)
            {
                context.Entry(savedOrder).State = System.Data.Entity.EntityState.Modified;

                context.SaveChanges();
            }
        }
예제 #4
0
 public void RemoveOrder(Order checkedOrder)
 {
     using (var context = new DataBaseService().DataBaseContext)
     {
         context.Orders.Attach(checkedOrder);
         context.Orders.Remove(checkedOrder);
         context.SaveChanges();
     }
 }
예제 #5
0
 public static DataBaseService GetInstance()
 {
     return(_instance ?? (_instance = new DataBaseService()));
 }