public async Task <List <Restaurant> > GetRestaurantsAsync(Province province, string keyword, List <RestaurantCategory> category) { //Get function APIDetail api = apisJson.SearchRestaurantsInProvince; //Set Fields api.AvailableBodys.Where(a => a.FieldName == "city_id").FirstOrDefault().ValueDefault = province.id.ToString();// 217 is id of HCM city api.AvailableBodys.Where(a => a.FieldName == "keyword").FirstOrDefault().ValueDefault = "" + keyword + ""; if (category != null) { StringBuilder icate = new StringBuilder(); foreach (var c in category) { icate.Append(",{\"code\":" + c.code + ",\"id\":" + c.id + "}"); } if (category.Count() != 0) { icate.Remove(0, 1); // remove the first comma } api.AvailableBodys.Where(a => a.FieldName == "combine_categories").FirstOrDefault().ValueDefault = "[" + icate + "]"; } //Call API RequestMethodFactory method = new RequestMethodFactory(api); var response = await method.CallApiAsync(); var result = response.Content.ReadAsStringAsync().Result; return(ConvertJson.ConvertString2ListRestaurant(result)); }