Exemplo n.º 1
0
        protected override async Task CompletedTemplateMethod(IDrinkRecipeBuilder drinkRecipeBuilder,
                                                              IList <DrinkIngredient> ingredients)
        {
            var drink = _drinkRecipeBuilder
                        .Default()
                        .SetName(DrinkName)
                        .SetByteImage(ByteImage)
                        .AddIngredients(ingredients.ToArray())
                        .Build();

            await _drinkRecipesRepository.InsertWithChildrenAsync(drink);

            await _userInteraction.DisplayAlertAsync("Info", "Drink Added to the Database!", "Ok");
        }
        public IEnumerable <DrinkRecipe> GetDefaultDrinks()
        {
            var madras = _drinkRecipeBuilder.Default(DrinkNames.Madras, Paths.Drinks.Madras)
                         .AddIngredient(new DrinkIngredient(160)
            {
                Ingredient = new Vodka()
            })
                         .AddIngredient(new DrinkIngredient(160)
            {
                Ingredient = new CranberryJuice()
            })
                         .AddIngredient(new DrinkIngredient(30)
            {
                Ingredient = new OrangeJuice()
            })
                         .Build();

            yield return(madras);

            var screwdriver = _drinkRecipeBuilder.Default(DrinkNames.Screwdriver, Paths.Drinks.Screwdriver)
                              .AddIngredient(new DrinkIngredient(160)
            {
                Ingredient = new Vodka()
            })
                              .AddIngredient(new DrinkIngredient(120)
            {
                Ingredient = new OrangeJuice()
            })
                              .Build();

            yield return(screwdriver);

            var lemonDrop = _drinkRecipeBuilder.Default(DrinkNames.LemonDrop, Paths.Drinks.Lemondrop)
                            .AddIngredient(new DrinkIngredient(160)
            {
                Ingredient = new Vodka()
            })
                            .AddIngredient(new DrinkIngredient(30)
            {
                Ingredient = new LemonJuice()
            })
                            .Build();

            yield return(lemonDrop);

            var whiskySour = _drinkRecipeBuilder.Default(DrinkNames.WhiskySour, Paths.Drinks.WhiskySour)
                             .AddIngredient(new DrinkIngredient(160)
            {
                Ingredient = new Whisky()
            })
                             .AddIngredient(new DrinkIngredient(15)
            {
                Ingredient = new OrangeJuice()
            })
                             .AddIngredient(new DrinkIngredient(30)
            {
                Ingredient = new LemonJuice()
            })
                             .Build();

            yield return(whiskySour);

            var blizzard = _drinkRecipeBuilder.Default(DrinkNames.Blizzard, Paths.Drinks.Blizzard)
                           .AddIngredient(new DrinkIngredient(60)
            {
                Ingredient = new Whisky()
            })
                           .AddIngredient(new DrinkIngredient(30)
            {
                Ingredient = new CranberryJuice()
            })
                           .AddIngredient(new DrinkIngredient(15)
            {
                Ingredient = new LemonJuice()
            })
                           .Build();

            yield return(blizzard);

            var capeCod = _drinkRecipeBuilder.Default(DrinkNames.CapeCod, Paths.Drinks.CapeCod)
                          .AddIngredient(new DrinkIngredient(160)
            {
                Ingredient = new Vodka()
            })
                          .AddIngredient(new DrinkIngredient(120)
            {
                Ingredient = new CranberryJuice()
            })
                          .Build();

            yield return(capeCod);

            var hotToddy = _drinkRecipeBuilder.Default(DrinkNames.HotToddy, Paths.Drinks.HotToddy)
                           .AddIngredient(new DrinkIngredient(160)
            {
                Ingredient = new Whisky()
            })
                           .AddIngredient(new DrinkIngredient(15)
            {
                Ingredient = new LemonJuice()
            })
                           .Build();

            yield return(hotToddy);

            var bourbonSquash = _drinkRecipeBuilder.Default(DrinkNames.BourbonSquash, Paths.Drinks.BourbonSquash)
                                .AddIngredient(new DrinkIngredient(160)
            {
                Ingredient = new Whisky()
            })
                                .AddIngredient(new DrinkIngredient(30)
            {
                Ingredient = new OrangeJuice()
            })
                                .AddIngredient(new DrinkIngredient(15)
            {
                Ingredient = new LemonJuice()
            })
                                .Build();

            yield return(bourbonSquash);
        }