Exemplo n.º 1
0
        public ActionResult Cocktails()
        {
            var model = new AdminCocktailsVM();

            model.Populate(_ingredientRepo.GetAllIngredients());

            return(View(model));
        }
Exemplo n.º 2
0
        // GET: Ingredient
        public ActionResult GetAllIngredients(string Sorting_Order, string Search_Data, string Filter_Value, int?Page_No)
        {
            ViewBag.Name = Sorting_Order;

            if (Search_Data != null)
            {
                Page_No = 1;
            }
            else
            {
                Search_Data = Filter_Value;
            }

            ViewBag.FilterValue = Search_Data;
            var ingredients = ingredientRepository.GetAllIngredients();

            if (!String.IsNullOrEmpty(Search_Data))
            {
                ingredients = ingredients.Where(x => !string.IsNullOrEmpty(x.Category) && x.Category.ToLower().Contains(Search_Data.Trim().ToLower()));
            }

            int Size_Of_Page = 10;
            int No_Of_Page   = (Page_No ?? 1);

            return(View(ingredients.ToPagedList(No_Of_Page, Size_Of_Page)));
        }
Exemplo n.º 3
0
        public ActionResult <List <Ingredient> > Get()
        {
            var ingredient = _ingredientRepository.GetAllIngredients();

            _log.Info("Listing all ingredients.");
            return(ingredient);
        }
Exemplo n.º 4
0
        public async Task <IActionResult> GetIngridients()
        {
            var ListOfIngredients = await _ingredientRepo.GetAllIngredients();

            if (ListOfIngredients == null)
            {
                return(NotFound());
            }

            return(Ok(ListOfIngredients));
        }
Exemplo n.º 5
0
        public IActionResult EditRecipe(int recipeId)
        {
            Recipe recipe = _recipeRepository.GetRecipe(recipeId);

            List <Ingredient> ingredients = _ingredientRepository.GetAllIngredients().Where(r => r.RecipeId == recipeId).ToList();

            EditRecipeViewModel editRecipeViewModel = new EditRecipeViewModel()
            {
                Id                = recipeId,
                Title             = recipe.Title,
                Description       = recipe.Description,
                Instructions      = recipe.Instructions,
                ExistingImagePath = recipe.ImagePath,
                MealType          = recipe.MealType,
                Servings          = recipe.Servings,
                PrepTime          = recipe.PrepTime,
                CookTime          = recipe.CookTime,
                Category          = recipe.Category,
                SpiceLevel        = recipe.SpiceLevel,
                Ingredients       = ingredients
            };

            return(View(editRecipeViewModel));
        }
Exemplo n.º 6
0
        public List <IngredientAng> ReturnAllLiquorIngredients()
        {
            if (_liquorIngredients == null)
            {
                _liquorIngredients = _ingredientRepo.GetAllIngredients()
                                     .Where(m => m.IsLiquor == true)
                                     .Select(m => new IngredientAng
                {
                    IngredientId = m.IngredientId,
                    Name         = m.Name
                })
                                     .OrderBy(m => m.Name)
                                     .ToList();
            }

            return(_liquorIngredients);
        }
Exemplo n.º 7
0
        public ActionResult Index()
        {
            //get all ingredients from db
            var ingredients = _ingredientRepo.GetAllIngredients();

            //convert ingredient model to view model format
            var model = new HomeIndexViewModel();

            foreach (var ingredient in ingredients)
            {
                if (ingredient.IsLiquor)
                {
                    model.Ingredients.Add(new HomeIndexIngredient
                    {
                        IngredientId = ingredient.IngredientId,
                        Name         = ingredient.Name
                    });
                }
            }

            return(View(model));
        }
Exemplo n.º 8
0
        public void CanGetAllIngredients()
        {
            var ingredients = _repo.GetAllIngredients();

            Assert.AreEqual(ingredients.Count, 15);
        }
 public IEnumerable <Ingredient> GetAllIngredients()
 {
     return(_potionRepo.GetAllIngredients());
 }
Exemplo n.º 10
0
 public async Task <IEnumerable <IngredientOutput> > ListIngredients()
 {
     return(await _ingredientRepository.GetAllIngredients());
 }