Skip to content
alex-caroline edited this page Jul 13, 2018 · 4 revisions

All foods that match search criteria

var foodQueryServiceClient = new FoodQueryServiceClient();
var foodListResponse = foodQueryServiceClient.Search(new FoodsSearchRequest {SearchText = "Oats"});

First 10 foods that match the search criteria

var foodQueryServiceClient = new FoodQueryServiceClient();
var foodsSearchRequest = new FoodsSearchRequest
{
    SearchText = "Oats",
    StartIndex = 1,
    PageSize = 10
};
var foodsListResponse = foodQueryServiceClient.Search(foodsSearchRequest);

First 10 Recipes foods that match the search criteria

var foodQueryServiceClient = new FoodQueryServiceClient();
var foodsSearchRequest = new FoodsSearchRequest
{
    SearchText = "Oats",
    FilterByFoodTypes = new[] {FoodType.Recipe},
    StartIndex = 1,
    PageSize = 10
};
var foodsListResponse = foodQueryServiceClient.Search(foodsSearchRequest);

All user ceated Recipes that mach the search criteria

var foodQueryServiceClient = new FoodQueryServiceClient();
var foodsSearchRequest = new FoodsSearchRequest
{
    SearchText = "Oats",
    FilterByFoodTypes = new[] {FoodType.Recipe},
    DataSourceFilter = new [] {"UserFoods"},
    StartIndex = 1,
    PageSize = 10
};
var foodsListResponse = foodQueryServiceClient.Search(foodsSearchRequest);
Clone this wiki locally