예제 #1
0
파일: NowService.cs 프로젝트: lnmthuc/fos
        public async Task <List <DeliveryInfos> > GetRestaurantsDeliveryInforAsync(List <Restaurant> restaurant)
        {
            //Get function
            APIDetail api = apisJson.GetRestaurantDeliveryInfor;
            //Set Fields
            StringBuilder rid = new StringBuilder();

            foreach (var r in restaurant)
            {
                rid.Append("," + r.restaurant_id);
            }
            if (restaurant.Count() != 0)
            {
                rid.Remove(0, 1);                         // remove the first comma
            }
            api.AvailableBodys.Where(a => a.FieldName == "restaurant_ids").FirstOrDefault().ValueDefault
                = "[" + rid + "]";// 217 is id of HCM city
            //Call API
            RequestMethodFactory method = new RequestMethodFactory(api);
            var response = await method.CallApiAsync();

            var result = response.Content.ReadAsStringAsync().Result;

            return(ConvertJson.ConvertString2ListDeliveryInfos(result));
        }
예제 #2
0
파일: NowService.cs 프로젝트: lnmthuc/fos
        public async Task <List <DeliveryInfos> > GetRestaurantDeliveryInforAsync(Restaurant restaurant)
        {
            //Get function
            APIDetail api = apisJson.GetRestaurantDeliveryInfor;

            //Set Fields
            api.AvailableBodys.Where(a => a.FieldName == "restaurant_ids").FirstOrDefault().ValueDefault
                = "[" + restaurant.restaurant_id.ToString() + "]";// 217 is id of HCM city
            //Call API
            RequestMethodFactory method = new RequestMethodFactory(api);
            var response = await method.CallApiAsync();

            var result = response.Content.ReadAsStringAsync().Result;

            return(ConvertJson.ConvertString2ListDeliveryInfos(result));
        }