Exemplo n.º 1
0
        public async Task <IEnumerable <IngredientDto> > GetAllAsync(int userId)
        {
            IEnumerable <Ingredient> ingredients = await _ingredientsRepository.GetAllAsync(userId);

            var result = ingredients.Select(x => _mapper.Map <IngredientDto>(x));

            return(result);
        }
Exemplo n.º 2
0
        public async Task ActivateAsync()
        {
            using (Ingredients.SuppressChangeNotifications())
            {
                Ingredients.Clear();
                var ingredients = await _ingredientsRepository.GetAllAsync();

                var ingredientViewModels = FilterIngredientsTemplateMethod(ingredients);

                var orderedIngredients = ingredientViewModels
                                         .OrderBy(i => !i.IsAvailable)
                                         .ThenBy(i => i.BottleIndex)
                                         .ToList();

                Ingredients.AddRange(orderedIngredients);
            }
        }