Пример #1
0
        public async Task <FoodItem> GetFoodItemAsTracked(FoodItem fakeFoodItem)
        {
            var realFoodItem = await FoodItems
                               .Where(v => v.FoodItemId == fakeFoodItem.FoodItemId)
                               .FirstAsync();

            return(realFoodItem);
        }
Пример #2
0
        public async Task <List <FoodItem> > GetOrderedFoodItemsAsync(string filterForTerm)
        {
            List <FoodItem> foodItems;

            if (filterForTerm == null)
            {
                foodItems = await FoodItems
                            .OrderBy(v => v.Name)
                            .ToListAsync();
            }
            else
            {
                filterForTerm = filterForTerm.ToLower();
                foodItems     = await FoodItems
                                .Where(v => v.Name.ToLower().Contains(filterForTerm))
                                .OrderBy(v => v.Name)
                                .ToListAsync();
            }
            return(foodItems);
        }