Beispiel #1
0
        static void Main(string[] args)
        {
            using (MacContext ctx = new MacContext())
            {
                ctx.Initialize(dropAlways: true);

                foreach (var burger in ctx.Burgers.ToList())
                {
                    Console.WriteLine(burger.Name);
                }

                Console.WriteLine("-----------");

                // NOT WORKING with RESTRICT !
                //(it's deny to delete a burger before the menu associate to the burger)

                //var brg = ctx.Burgers.Single(b => b.Name == "720");
                //ctx.Burgers.Remove(brg);

                //ctx.SaveChanges();

                //var m = ctx.Menus.First();
                //ctx.Menus.Remove(m);

                //ctx.SaveChanges();

                //foreach (var burger in ctx.Burgers.ToList())
                //{
                //    Console.WriteLine(burger.Name);
                //}

                //WORKING !
                var m = ctx.Menus.First();
                ctx.Menus.Remove(m);

                ctx.SaveChanges();

                var brg = ctx.Burgers.Single(b => b.Name == "720");
                ctx.Burgers.Remove(brg);

                ctx.SaveChanges();

                foreach (var burger in ctx.Burgers.ToList())
                {
                    Console.WriteLine(burger.Name);
                }
            }

            Console.ReadLine();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            using (MacContext ctx = new MacContext())
            {
                ctx.Initialize(dropAlways: true);

                foreach (var menu in ctx.Menus.ToList())
                {
                    Console.WriteLine(menu.Name);
                    Console.WriteLine("Burger = " + menu.Burger.Name);
                    Console.WriteLine("Beverage = " + menu.Beverage.Name);
                    Console.WriteLine("Side = " + menu.Side.Name);
                    Console.WriteLine("Dessert = " + menu.Dessert.Name);
                    Console.WriteLine("-----------");
                }
            }
            Console.ReadLine();
        }
 public DessertsController(MacContext context)
 {
     _context = context;
 }
Beispiel #4
0
 public BeveragesController(MacContext context)
 {
     _context = context;
 }
Beispiel #5
0
 public SidesController(MacContext context)
 {
     _context = context;
 }
Beispiel #6
0
 public OrdersController(MacContext context)
 {
     _context = context;
 }
 public HomeController(MacContext context)
 {
     _context = context;
 }
 public BurgersController(MacContext context)
 {
     _context = context;
 }
 public BasketCardsController(MacContext context)
 {
     _context = context;
 }
Beispiel #10
0
 public MenusController(MacContext context)
 {
     _context = context;
 }
 public BasketCardsService(MacContext context)
 {
     this.context = context;
 }
Beispiel #12
0
 public OrderService(MacContext context)
 {
     this.context = context;
 }