public async Task <FoodItem> GetFoodItemAsTracked(FoodItem fakeFoodItem) { var realFoodItem = await FoodItems .Where(v => v.FoodItemId == fakeFoodItem.FoodItemId) .FirstAsync(); return(realFoodItem); }
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); }