Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            //IRecipe recipe = new Recipe("Mix Test");
            //recipe.AddIngredientContent(new Ingre)



            using (IngredientContext ctx = new IngredientContext())
            {
                List <IIngredient> ingredients = ctx.LoadEverything();
                for (int i = 0; i < ingredients.Count; i++)
                {
                    Console.Write(ingredients[i].IngredientID + "|");
                    Console.Write(ingredients[i].Name + "|");
                    if (ingredients[i] is IAlcholic)
                    {
                        Console.Write(((IAlcholic)ingredients[i]).Percentage + "%");
                    }
                    else
                    {
                        Console.Write("N/A");
                    }
                    Console.WriteLine("|");
                }
            }
            Console.WriteLine("Uploded data to Database");
            Console.ReadKey();
        }
Ejemplo n.º 2
0
        public static void IngredientMaker(IServiceProvider serviceProvider)
        {
            using var context = new IngredientContext(
                      serviceProvider.GetRequiredService <DbContextOptions <IngredientContext> >());

            if (context.Ingredients.Any())
            {
                return;   // DB has been seeded
            }
            else
            {
                GetIngredients();
                foreach (Ingredients ingredient in IngredientList)
                {
                    context.Ingredients.Add(ingredient);
                    context.SaveChanges();
                }
            }
        }
Ejemplo n.º 3
0
        static void AddDatabaseEntries()
        {
            using (IngredientContext ctx = new IngredientContext())
            {
                ctx.AddIngridientBase(new Liqour("Vodka", 37.5f));
                ctx.AddIngridientBase(new Liqour("Whisky", 40f));
                ctx.AddIngridientBase(new Mixer("Apple Juice"));
                ctx.AddIngridientBase(new Mixer("Mango Juice"));
                ctx.AddIngridientBase(new Mixer("Orange Juice"));
                ctx.AddIngridientBase(new Accessory("Ice cube"));
                ctx.AddIngridientBase(new Accessory("Straw"));
                ctx.AddIngridientBase(new Accessory("Melon"));
                ctx.AddIngridientBase(new Accessory("Olive"));
                ctx.AddIngridientBase(new Liqour("Gin", 40f));

                ctx.AddIngridientBase(new Mixer("Sprite"));
                ctx.AddIngridientBase(new Mixer("Lime Juice"));
                ctx.AddIngridientBase(new Mixer("Cranberry Juice"));
            }
        }
Ejemplo n.º 4
0
 public ProduceRepository(IngredientContext ingredientContext, Director director)
 {
     this._ingredientContext = ingredientContext;
     this._director          = director;
 }
Ejemplo n.º 5
0
 public HomeController(ILogger <HomeController> logger, IngredientContext context, MenuDishContext contextMenu)
 {
     _logger      = logger;
     _context     = context;
     _contextMenu = contextMenu;
 }