public async Task <IActionResult> AddPizza(CreateMenuModel model)
        {
            if (model.Pizza != null)
            {
                var pizza = model.Pizza;
                pizza.Id           = Guid.NewGuid().ToString();
                pizza.RestaurantId = context.Restaurants.Where(o => o.Owner.Id == userManager.GetUserAsync(User).Result.Id).First().Id;
                pizza.InMenu       = true;
                if (context.Pizzas.Where(o => o.RestaurantId == pizza.RestaurantId && o.Name == pizza.Name).Count() < 1)
                {
                    context.Pizzas.Add(pizza);
                    await context.SaveChangesAsync();
                }
                else
                {
                    ModelState.AddModelError("1337", "A pizza with that name already exists.");
                }
            }
            else
            {
                ModelState.AddModelError("800815", "You need to add something.");
            }

            return(RedirectToAction("EditMenu"));
        }
        public async Task <IActionResult> AddIngredients(CreateMenuModel model)
        {
            if (model.Ingredient != null)
            {
                var ingredient = model.Ingredient;
                ingredient.Id           = Guid.NewGuid().ToString();
                ingredient.RestaurantId = context.Restaurants.Where(o => o.Owner.Id == userManager.GetUserAsync(User).Result.Id).First().Id;
                ingredient.InMenu       = true;
                if (!context.Ingredients.Any(o => o.IngredientType == ingredient.IngredientType && o.RestaurantId == ingredient.RestaurantId))
                {
                    context.Ingredients.Add(ingredient);
                    await context.SaveChangesAsync();
                }
                else
                {
                    ModelState.AddModelError("1337", "A ingredient with that name already exists.");
                }
            }
            else
            {
                ModelState.AddModelError("800815", "You need to add something.");
            }

            return(RedirectToAction("EditMenu"));
        }
        public IActionResult EditMenu()
        {
            var model = new CreateMenuModel();

            model.Restaurant         = context.Restaurants.Where(o => o.Owner.Id == userManager.GetUserAsync(User).Result.Id).First();
            model.CurrentMenu        = context.Pizzas.Where(o => o.RestaurantId == model.Restaurant.Id && o.InMenu).ToList();
            model.CurrentIngredients = context.Ingredients.Where(o => o.RestaurantId == model.Restaurant.Id).ToList();

            if (model.Restaurant != null)
            {
                return(View(model));
            }
            else
            {
                return(RedirectToAction("AddRestaurant"));
            }
        }