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(); }
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(); } } }
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")); } }
public ProduceRepository(IngredientContext ingredientContext, Director director) { this._ingredientContext = ingredientContext; this._director = director; }
public HomeController(ILogger <HomeController> logger, IngredientContext context, MenuDishContext contextMenu) { _logger = logger; _context = context; _contextMenu = contextMenu; }