//Dictionary<string, int> a
        public NewItemPage(List <string> name, List <int> amount)
        {
            InitializeComponent();

            Item = new Cocktails
            {
                Name = "Item name"
            };

            //showIngridients(amount, first);
            var a = "";
            var b = "";

            //int length = name.Count;

            for (int i = 0; i < name.Count; i++)
            {
                a += name[i].ToString() + " ";
                b += amount[i].ToString() + " ";
            }

            firstIngredient.Text  = name[0].ToString();
            firstAmount.Text      = amount[0].ToString();
            secondIngredient.Text = name[1].ToString();
            secondAmount.Text     = amount[1].ToString();
            thirdIngredient.Text  = name[2].ToString();
            thirdAmount.Text      = amount[2].ToString();
            fourthIngredient.Text = name[3].ToString();
            fourthAmount.Text     = amount[3].ToString();
            BindingContext        = this;
        }
Beispiel #2
0
        public void addCocktail(Cocktails coc)
        {
            CocktailDataBaseBinder cocktail = coc.toDB();

            cocktails.Add(cocktail);
            SaveChanges();
        }
 public ItemDetailViewModel(Cocktails item = null)
 {
     Title         = item?.Name;
     Degrees       = item.DegreesCocktail;
     Prescriptions = item.Prescriptions;
     //Item.DegreesCocktail = item.DegreesCocktail;
 }
Beispiel #4
0
        // GET: Cocktails
        public async Task <IActionResult> Index()
        {
            var userId   = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
            var homeCook = _context.HomeCook.Where(c => c.IdentityUserId ==
                                                   userId).SingleOrDefault();
            DrinkIngredient drinkIngredient = await _cocktailIngredientRequest.GetDrinkIngredient();

            List <SelectListItem> ingredients = new List <SelectListItem>();
            var _ingredients = drinkIngredient.drinks.Select(a => new SelectListItem()
            {
                Text  = a.strIngredient1,
                Value = a.strIngredient1
            });

            ingredients = _ingredients.OrderBy(a => a.Text).ToList();
            string    selectedIngredient = ingredients.Select(a => a.Value).FirstOrDefault().ToString();
            Cocktails cocktails          = await _cocktailByIngredientRequest.GetCocktailsByIngredients(selectedIngredient);

            CocktailViewModel cocktailView = new CocktailViewModel()
            {
                Cocktail    = cocktails,
                Ingredients = ingredients,
                HomeCook    = homeCook
            };

            return(View(cocktailView));
        }
Beispiel #5
0
        public Cocktail Cocktail(Cocktails id)
        {
            using (var db = new SqlConnection(connectionString))
            {
                var results = db.Query <Cocktail>(
                    @"SELECT C.Id, C.Name, C.Ice, C.Color,
                    C.Vessel, V.Name AS VesselName,
                    C.PrepMethod, P.Name AS PrepMethodName,
                    C.Garnish, STUFF(
                        (SELECT ', and ' + Name
                        FROM Garnish G
                        WHERE (C.Garnish & G.Id) != 0
                        For XML PATH ('')), 1, 6, '') AS GarnishName
                    FROM Cocktail C
                    LEFT JOIN Vessel V ON V.Id = C.Vessel
                    LEFT JOIN PrepMethod P ON P.Id = C.PrepMethod
                    WHERE C.Id = @id"
                    , new { id });

                if (!results.Any())
                {
                    return(null);
                }

                var cocktail = results.First();
                cocktail.Recipe  = CocktailIngredients(db, cocktail.Id);
                cocktail.Similar = SimilarCocktails(db, cocktail);
                return(cocktail);
            }
        }
Beispiel #6
0
        public async Task <IActionResult> Edit(int id, [Bind("CocktailsId")] Cocktails cocktails)
        {
            if (id != cocktails.CocktailsId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cocktails);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CocktailsExists(cocktails.CocktailsId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(cocktails));
        }
        // Switch from user to his favourite cocktails
        public ActionResult FromUserToCocktailInfo(int cid)
        {
            CocktailDal dal = new CocktailDal();
            Cocktails   coc = dal.findCocktail(cid);

            return(View("CocktailInfo", coc));
        }
        public ActionResult createCocktail(Cocktails coc)
        {
            ViewData["missingPrepInput"] = "";
            ViewData["missingIngInput"]  = "";
            ViewData["missingNameInput"] = "";
            if (Request.Form["name"] != "" && Request.Form["preperation"] != "" && Request.Form["name0"] != null)
            {
                string cocktailName = Request.Form["name"];
                string category     = Request.Form["category"];
                string preperation  = Request.Form["preperation"];
                string video        = Request.Form["video"];

                CocktailDal dal1 = new CocktailDal();
                if (dal1.locate(cocktailName))
                {
                    ViewData["cocktailExistError"] = "Cocktail is already exist";
                    return(View("createCocktail", coc));
                }

                List <Ingredient> ingredients = new List <Ingredient>();
                for (int i = 0; ; i++)
                {
                    if (Request.Form["name" + i.ToString()] == null)
                    {
                        break;
                    }
                    string name   = Request.Form["name" + i.ToString()];
                    string amount = Request.Form["amount" + i.ToString()];
                    ingredients.Add(new Ingredient(name, amount));
                }
                int cid = generateUniqueId();
                coc = new Cocktails(cid, ingredients, convertToCat(category), preperation, video, cocktailName);
                if (!checkCocktailForm(coc))
                {
                    return(View("createCocktail", coc));
                }
                CocktailDal dal = new CocktailDal();
                dal.addCocktail(coc);
                foreach (Ingredient ing in ingredients)
                {
                    dal.addIngredient(ing, cid);
                }
                ViewData["addedMessage"] = "Cocktail was inserted successfully! You can see it in homepage.";
                return(View("createCocktail", new Cocktails()));
            }
            if (Request.Form["preperation"] == "")
            {
                ViewData["missingPrepInput"] = "Preperation was not inserted.";
            }
            if (Request.Form["name0"] == null)
            {
                ViewData["missingIngInput"] = "Ingredients was not inserted.";
            }
            if (Request.Form["name"] == "")
            {
                ViewData["missingNameInput"] = "Name was not inserted.";
            }
            return(View("createCocktail", coc));
        }
        // Cocktail info page
        public ActionResult CocktailInfo()
        {
            string      cocktailName = Request.Form["cocktailName"];
            CocktailDal dal          = new CocktailDal();
            Cocktails   coc          = dal.findCocktail(cocktailName);

            return(View(coc));
        }
Beispiel #10
0
 public override void OnNavigatedTo(INavigationParameters parameters)
 {
     if (Cocktails != null && Cocktails.Count > 0)
     {
         IsLoading = true;
         cocktailsManager.MapCocktailFavorites(Cocktails.ToList());
         IsLoading = false;
     }
 }
Beispiel #11
0
        public async Task <IActionResult> Create([Bind("CocktailsId")] Cocktails cocktails)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cocktails);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(cocktails));
        }
Beispiel #12
0
        public async Task <int> Create(Cocktails data)
        {
            var dbparams = new DynamicParameters();

            dbparams.Add("Id", data.id, DbType.Int32);
            var result = await Task.FromResult(_dapper.Insert <int>("[dbo].[SP_Add_Article]"
                                                                    , dbparams,
                                                                    commandType: CommandType.StoredProcedure));

            return(result);
        }
        public ItemDetailPage()
        {
            InitializeComponent();

            var item = new Cocktails
            {
                Name = "Item 1"
            };

            viewModel      = new ItemDetailViewModel(item);
            BindingContext = viewModel;
        }
Beispiel #14
0
        // Add cocktail to user's favourites
        public ActionResult addCocktailToFavourites(string userName, int cid)
        {
            UserDal dal = new UserDal();

            dal.addFavCocktail(userName, cid);
            RegularUser user     = Session["tempUser"] as RegularUser;
            CocktailDal coc      = new CocktailDal();
            Cocktails   cocktail = coc.findCocktail(cid);

            user.addFavCocktail(cocktail);
            return(View("~/Views/Home/CocktailInfo.cshtml", cocktail));
        }
Beispiel #15
0
        // Check validation of cocktail form
        public bool checkCocktailForm(Cocktails cocktail)
        {
            IngredientDal ingdal = new IngredientDal();

            foreach (Ingredient ing in cocktail.ing)
            {
                if (ing.name == "" || ing.amount == "" || ingdal.locate(ing.name, cocktail.cid))
                {
                    return(false);
                }
            }
            return(true);
        }
Beispiel #16
0
        public Task <int> Update(Cocktails data)
        {
            var dbPara = new DynamicParameters();

            dbPara.Add("Id", data.id);
            dbPara.Add("Name", data.name, DbType.String);

            var updateArticle = Task.FromResult(_dapper.Update <int>("[dbo].[SP_Update_Article]",
                                                                     dbPara,
                                                                     commandType: CommandType.StoredProcedure));

            return(updateArticle);
        }
        public async Task <Cocktails> GetCocktailsByIngredients(string ingredient)
        {
            string              url      = $"https://www.thecocktaildb.com/api/json/v1/1/filter.php?i={ingredient}";
            HttpClient          client   = new HttpClient();
            HttpResponseMessage response = await client.GetAsync(url);

            if (response.IsSuccessStatusCode)
            {
                string json = await response.Content.ReadAsStringAsync();

                Cocktails cocktails = JsonConvert.DeserializeObject <Cocktails>(json);
                return(cocktails);
            }
            return(null);
        }
Beispiel #18
0
        public Cocktail(Cocktails id, string name, string color, bool ice, Vessels vessel, PrepMethods prepMethod, Garnishes garnish,
                        params CocktailIngredient[] recipe)
        {
            Id   = id;
            Name = name;
            Ice  = ice;

            Vessel     = vessel;
            PrepMethod = prepMethod;
            Garnish    = garnish;

            Recipe = recipe;

            Color = color;
        }
Beispiel #19
0
        public void addFavCocktail(string userName, int cid)
        {
            CocktailDal cocDal = new CocktailDal();
            Cocktails   coc    = cocDal.findCocktail(cid);

            foreach (UserDataBaseBinder us in users)
            {
                if (us.userName == userName)
                {
                    RegularUser get = us.getUser();
                    get.addFavCocktail(coc);
                    us.favouriteCocktails = get.createCocktailString();
                }
            }
            SaveChanges();
        }
Beispiel #20
0
        public async Task <IActionResult> SaveDrink(CocktailViewModel cocktailView)
        {
            var userId   = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
            var homeCook = _context.HomeCook.Where(c => c.IdentityUserId ==
                                                   userId).SingleOrDefault();

            cocktailView.HomeCook = homeCook;
            _context.SavedDrinks.Add(new SavedDrinks()
            {
                Name         = cocktailView.CocktailDescription.drinks[0].strDrink,
                Ingredient1  = $"{cocktailView.CocktailDescription.drinks[0].strMeasure1} {cocktailView.CocktailDescription.drinks[0].strIngredient1}",
                Ingredient2  = $"{cocktailView.CocktailDescription.drinks[0].strMeasure2} {cocktailView.CocktailDescription.drinks[0].strIngredient2}",
                Ingredient3  = $"{cocktailView.CocktailDescription.drinks[0].strMeasure3} {cocktailView.CocktailDescription.drinks[0].strIngredient3}",
                Ingredient4  = $"{cocktailView.CocktailDescription.drinks[0].strMeasure4} {cocktailView.CocktailDescription.drinks[0].strIngredient4}",
                Ingredient5  = $"{cocktailView.CocktailDescription.drinks[0].strMeasure5} {cocktailView.CocktailDescription.drinks[0].strIngredient5}",
                Ingredient6  = $"{cocktailView.CocktailDescription.drinks[0].strMeasure6} {cocktailView.CocktailDescription.drinks[0].strIngredient6}",
                Ingredient7  = $"{cocktailView.CocktailDescription.drinks[0].strMeasure7} {cocktailView.CocktailDescription.drinks[0].strIngredient7}",
                Ingredient8  = $"{cocktailView.CocktailDescription.drinks[0].strMeasure8} {cocktailView.CocktailDescription.drinks[0].strIngredient8}",
                Ingredient9  = $"{cocktailView.CocktailDescription.drinks[0].strMeasure9} {cocktailView.CocktailDescription.drinks[0].strIngredient9}",
                Ingredient10 = $"{cocktailView.CocktailDescription.drinks[0].strMeasure10} {cocktailView.CocktailDescription.drinks[0].strIngredient10}",
                Ingredient11 = $"{cocktailView.CocktailDescription.drinks[0].strMeasure11} {cocktailView.CocktailDescription.drinks[0].strIngredient11}",
                Ingredient12 = $"{cocktailView.CocktailDescription.drinks[0].strMeasure12} {cocktailView.CocktailDescription.drinks[0].strIngredient12}",
                Ingredient13 = $"{cocktailView.CocktailDescription.drinks[0].strMeasure13} {cocktailView.CocktailDescription.drinks[0].strIngredient13}",
                Ingredient14 = $"{cocktailView.CocktailDescription.drinks[0].strMeasure14} {cocktailView.CocktailDescription.drinks[0].strIngredient14}",
                Ingredient15 = $"{cocktailView.CocktailDescription.drinks[0].strMeasure15} {cocktailView.CocktailDescription.drinks[0].strIngredient15}",
                Recipe       = cocktailView.CocktailDescription.drinks[0].strInstructions,
                HomeCook     = homeCook
            });
            DrinkIngredient drinkIngredient = await _cocktailIngredientRequest.GetDrinkIngredient();

            List <SelectListItem> ingredients = new List <SelectListItem>();
            var _ingredients = drinkIngredient.drinks.Select(a => new SelectListItem()
            {
                Text  = a.strIngredient1,
                Value = a.strIngredient1
            });

            ingredients = _ingredients.OrderBy(a => a.Text).ToList();
            string    selectedIngredient = ingredients.Select(a => a.Value).FirstOrDefault().ToString();
            Cocktails cocktails          = await _cocktailByIngredientRequest.GetCocktailsByIngredients(selectedIngredient);

            cocktailView.Cocktail    = cocktails;
            cocktailView.Ingredients = ingredients;
            _context.SaveChanges();
            return(View("Index", cocktailView));
        }
Beispiel #21
0
        public ActionResult Data(Cocktails id)
        {
            var cocktail = cocktailService.Cocktail(id);

            return(JsonContent(new
            {
                cocktail.Id,
                cocktail.Name,
                recipe = cocktail.Recipe.Select(ingredient => {
                    var quantity = ingredient.Quantity.ToString("0.#") + (ingredient.IsDiscrete ? "" : " ml");
                    return new
                    {
                        id = ingredient.Ingredient,
                        ingredient.Name,
                        ingredient.IsOptional,
                        quantity,
                        quantityWords = ingredient.QuantityWords(),
                    };
                }),
                description = cocktail.Description(),
                image = ImageService.CocktailImage(cocktail, 200, "cocktail-image"),
                similar = cocktail.Similar.Select(CocktailSummary),
            }));
        }
Beispiel #22
0
        private IEnumerable <CocktailIngredient> CocktailIngredients(SqlConnection db, Cocktails cocktail)
        {
            var ingredientSql =
                $"WITH {SuperAndSubIngredient}" +
                "SELECT CI.Ingredient, I.Name, CI.IsOptional, CI.Quantity, I.IsDiscrete, " +
                "CI.SpecialPrep, S.Name AS SpecialPrepName, SI.Super " +
                "FROM CocktailIngredient CI " +
                "LEFT JOIN Ingredient I ON I.Id = CI.Ingredient " +
                "LEFT JOIN SpecialPrep S ON S.Id = CI.SpecialPrep " +
                "LEFT JOIN SubIngredient SI ON SI.Id = I.Id " +
                "WHERE CI.Cocktail = @Cocktail";

            return(db.Query <CocktailIngredient>(ingredientSql, new { Cocktail = cocktail }));
        }
Beispiel #23
0
 public Cocktail(Cocktails id, string name, string color, Vessels vessel, PrepMethods prepMethod, Garnishes garnish,
                 params CocktailIngredient[] recipe) : this(id, name, color, false, vessel, prepMethod, garnish, recipe)
 {
 }
        //Guardar Contrato
        private async void btnGuardar_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Contratos c = new Contratos()
                {
                    Cliente            = listaClientes.BuscarCliente(txtRut.Text),
                    NumeroContrato     = txtNumeroGuardar.Text,
                    NombreEvento       = txtNombreEvento.Text,
                    ModalidadServicio  = (ModalidadServicios)cboModalidad.SelectedItem,
                    Direccion          = txtDireccion.Text,
                    CantidadAsistentes = (int)txtCantidadAsistentes.Value,
                    PersonalAdicional  = (int)txtCantPersonalAdicional.Value,
                    Total         = double.Parse(txtValorTotal.Text),
                    Observaciones = txtObservaciones.Text,
                    InicioEvento  = dpFechaInicio.SelectedDate.Value,
                    TerminoEvento = dpFechaTermino.SelectedDate.Value
                };

                ValidationContrato coval = new ValidationContrato();
                FluentValidation.Results.ValidationResult result = coval.Validate(c);
                if (result.IsValid == true)
                {
                    if (c.ModalidadServicio.TipoEvento.Id == 10)
                    {
                        CoffeBreaks cb = new CoffeBreaks()
                        {
                            Numero      = c.NumeroContrato,
                            Vegetariano = (bool)chkVegetariano.IsChecked
                        };
                        listaContratos.AgregarExtra(cb);
                    }
                    else if (c.ModalidadServicio.TipoEvento.Id == 20)
                    {
                        Cocktails cb = new Cocktails()
                        {
                            Numero            = c.NumeroContrato,
                            PoseeAmbientacion = (bool)chkAmbientacion.IsChecked,
                            MusicaAmbiental   = (bool)chkMusica.IsChecked,
                            MusicaCliente     = (bool)chkMusiCli.IsChecked
                        };
                        if (chkAmbientacion.IsChecked == false)
                        {
                            cb.Ambientacion = new Ambientacion(10);
                        }
                        else
                        {
                            cb.Ambientacion = (Ambientacion)cboAmbientacion.SelectedItem;
                        }
                        listaContratos.AgregarExtra(cb);
                    }
                    else if (c.ModalidadServicio.TipoEvento.Id == 30)
                    {
                        Cena cb = new Cena()
                        {
                            Numero          = c.NumeroContrato,
                            Ambientacion    = (Ambientacion)cboAmbientacion.SelectedItem,
                            MusicaAmbiental = (bool)chkMusica.IsChecked,
                            LocalOnBreak    = (bool)rbnLocalOnBreak.IsChecked,
                            OtroLocal       = (bool)rbnLocalOtro.IsChecked,
                            ValorArriendo   = double.Parse(txtValorArriendo.Text)
                        };
                        listaContratos.AgregarExtra(cb);
                    }
                    ;

                    if (listaContratos.GuardarContrato(c) == true)
                    {
                        await this.ShowMessageAsync("Exito", "Contrato Agregado con Exito");

                        Limpiar();
                        AuxiliarClases.NotificationCenter.Notify("ListadoContratos");
                    }
                    else
                    {
                        await this.ShowMessageAsync("Error", "Error al agregar Contrato");
                    }
                }
                else
                {
                    string bigString = "Verifique los datos" + Environment.NewLine;
                    foreach (var error in result.Errors)
                    {
                        bigString += error + Environment.NewLine;
                    }
                    await this.ShowMessageAsync("Error", bigString);
                }
            }
            catch (Exception)
            {
                await this.ShowMessageAsync("Error", "Error al intentar Agregar Contrato" + Environment.NewLine +
                                            "Verifique que todos los campos esten rellenados correctamente e intentelo nuevamente");
            }
        }
 //Buscar Contrato por Boton NumeroContrato
 private async void btnBuscarNumeroContrato_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         String    numeroContrato = txtNumeroContrato.Text;
         Contratos c = listaContratos.BuscarContrato(numeroContrato);
         txtRut.Text                 = c.Cliente.Rut;
         txtNombreContacto.Text      = c.Cliente.NombreContacto;
         txtNombreEvento.Text        = c.NombreEvento;
         txtDireccion.Text           = c.Direccion;
         cboTipoEvento.SelectedValue = c.ModalidadServicio.TipoEvento.Id;
         int aux = cboTipoEvento.Items.IndexOf(cboTipoEvento.SelectedItem);
         cboTipoEvento.SelectedIndex    = -1;
         cboTipoEvento.SelectedIndex    = aux;
         cboModalidad.SelectedValue     = c.ModalidadServicio.Id;
         txtPrecioBase.Text             = c.ModalidadServicio.Valorbase.ToString();
         txtPersonalBase.Text           = c.ModalidadServicio.PersonalBase.ToString();
         txtCantidadAsistentes.Value    = (Double)c.CantidadAsistentes;
         txtCantPersonalAdicional.Value = (Double)c.PersonalAdicional;
         txtValorTotal.Text             = c.Total.ToString("n2");
         dpFechaInicio.SelectedDate     = c.InicioEvento;
         dpFechaTermino.SelectedDate    = c.TerminoEvento;
         txtObservaciones.Text          = c.Observaciones;
         if (c.Realizado == true && c.TerminoContrato != null)
         {
             rbVigente.IsChecked  = true;
             rbVigente.Content    = "Realizado";
             rbVigente.Foreground = Brushes.Red;
             rbVigente.Visibility = Visibility.Visible;
         }
         else if ((c.Realizado == false && c.TerminoContrato != null))
         {
             rbVigente.IsChecked  = true;
             rbVigente.Content    = "No Realizado";
             rbVigente.Foreground = Brushes.Red;
             rbVigente.Visibility = Visibility.Visible;
         }
         ;
         if (c.ModalidadServicio.TipoEvento.Id == 10)
         {
             CoffeBreaks cb = (CoffeBreaks)listaContratos.BuscarDatosExtra(c.NumeroContrato);
             chkVegetariano.IsChecked = (bool)cb.Vegetariano;
         }
         else if (c.ModalidadServicio.TipoEvento.Id == 20)
         {
             Cocktails cb = (Cocktails)listaContratos.BuscarDatosExtra(c.NumeroContrato);
             chkAmbientacion.IsChecked = (bool)cb.PoseeAmbientacion;
             chkMusica.IsChecked       = (bool)cb.MusicaAmbiental;
             chkMusiCli.IsChecked      = (bool)cb.MusicaCliente;
             if (chkAmbientacion.IsChecked == false)
             {
                 cboAmbientacion.SelectedIndex = -1;
             }
             else
             {
                 cboAmbientacion.SelectedValue = cb.Ambientacion.IdAmbientacion;
             }
         }
         else if (c.ModalidadServicio.TipoEvento.Id == 30)
         {
             Cena cb = (Cena)listaContratos.BuscarDatosExtra(c.NumeroContrato);
             chkAmbientacion.IsChecked     = true;
             cboAmbientacion.SelectedValue = cb.Ambientacion.IdAmbientacion;
             chkMusica.IsChecked           = (bool)cb.MusicaAmbiental;
             rbnLocalOnBreak.IsChecked     = (bool)cb.LocalOnBreak;
             rbnLocalOtro.IsChecked        = (bool)cb.OtroLocal;
             txtValorArriendo.Text         = cb.ValorArriendo.ToString("n2");
         }
         ;
     }
     catch (Exception)
     {
         await this.ShowMessageAsync("Error", "Error al Buscar Contrato", MessageDialogStyle.Affirmative);
     }
 }
Beispiel #26
0
        public async Task <IActionResult> Cart(string id)
        {
            var userId   = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
            var homeCook = _context.HomeCook.Where(c => c.IdentityUserId ==
                                                   userId).SingleOrDefault();
            CocktailDescription cocktailDescription = await _cocktailDescriptionRequest.GetCocktailDescription(id);

            string items = "";

            if (cocktailDescription.drinks[0].strIngredient1 != null)
            {
                items += cocktailDescription.drinks[0].strIngredient1 + " , ";
            }
            if (cocktailDescription.drinks[0].strIngredient2 != null)
            {
                items += cocktailDescription.drinks[0].strIngredient2 + " , ";
            }
            if (cocktailDescription.drinks[0].strIngredient3 != null)
            {
                items += cocktailDescription.drinks[0].strIngredient3 + " , ";
            }
            if (cocktailDescription.drinks[0].strIngredient4 != null)
            {
                items += cocktailDescription.drinks[0].strIngredient4 + " , ";
            }
            if (cocktailDescription.drinks[0].strIngredient5 != null)
            {
                items += cocktailDescription.drinks[0].strIngredient5 + " , ";
            }
            if (cocktailDescription.drinks[0].strIngredient6 != null)
            {
                items += cocktailDescription.drinks[0].strIngredient6 + " , ";
            }
            if (cocktailDescription.drinks[0].strIngredient7 != null)
            {
                items += cocktailDescription.drinks[0].strIngredient7 + " , ";
            }
            if (cocktailDescription.drinks[0].strIngredient8 != null)
            {
                items += cocktailDescription.drinks[0].strIngredient8 + " , ";
            }
            if (cocktailDescription.drinks[0].strIngredient9 != null)
            {
                items += cocktailDescription.drinks[0].strIngredient9 + " , ";
            }
            if (cocktailDescription.drinks[0].strIngredient10 != null)
            {
                items += cocktailDescription.drinks[0].strIngredient10 + " , ";
            }
            if (cocktailDescription.drinks[0].strIngredient11 != null)
            {
                items += cocktailDescription.drinks[0].strIngredient11 + " , ";
            }
            if (cocktailDescription.drinks[0].strIngredient12 != null)
            {
                items += cocktailDescription.drinks[0].strIngredient12 + " , ";
            }
            if (cocktailDescription.drinks[0].strIngredient13 != null)
            {
                items += cocktailDescription.drinks[0].strIngredient13 + " , ";
            }
            if (cocktailDescription.drinks[0].strIngredient14 != null)
            {
                items += cocktailDescription.drinks[0].strIngredient14 + " , ";
            }
            if (cocktailDescription.drinks[0].strIngredient15 != null)
            {
                items += cocktailDescription.drinks[0].strIngredient15 + " , ";
            }
            ShoppingCart cart = _context.ShoppingCart.Where(a => a.HomeCookId == homeCook.HomeCookId).FirstOrDefault();

            if (cart == null)
            {
                cart = new ShoppingCart()
                {
                    Items    = items,
                    HomeCook = homeCook
                };
                _context.ShoppingCart.Add(cart);
            }
            else
            {
                cart.Items   += items;
                cart.HomeCook = homeCook;
                _context.ShoppingCart.Update(cart);
            }
            _context.SaveChanges();
            DrinkIngredient drinkIngredient = await _cocktailIngredientRequest.GetDrinkIngredient();

            List <SelectListItem> ingredients = new List <SelectListItem>();
            var _ingredients = drinkIngredient.drinks.Select(a => new SelectListItem()
            {
                Text  = a.strIngredient1,
                Value = a.strIngredient1
            });

            ingredients = _ingredients.OrderBy(a => a.Text).ToList();
            string    selectedIngredient = ingredients.Select(a => a.Value).FirstOrDefault().ToString();
            Cocktails cocktails          = await _cocktailByIngredientRequest.GetCocktailsByIngredients(selectedIngredient);

            CocktailViewModel cocktailView = new CocktailViewModel()
            {
                Cocktail    = cocktails,
                HomeCook    = homeCook,
                Ingredients = ingredients
            };

            return(View("Index", cocktailView));
        }