コード例 #1
0
        public List <RestaurantListResultModel> GetRestaurantList(RestaurantListInfoModel im)
        {
            var mapConfig = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <RestaurantListInfoModel, RestaurantListCondition>();
            });
            var mapper = mapConfig.CreateMapper();
            RestaurantListCondition c = mapper.Map <RestaurantListCondition>(im);

            var rm = _restaurantClient.GetRestaurantList(c).Result;

            return(rm);
        }
コード例 #2
0
ファイル: RestaurantClient.cs プロジェクト: kuro1103/kcode
        public async Task <List <RestaurantListResultModel> > GetRestaurantList(RestaurantListCondition condition)
        {
            var http = new HttpClient();

            var requestUrl = $"http://localhost:378/api/v1/Restaurant/GetRestaurantList?param.restaurantName={condition.RestaurantName}";

            var response = await http.GetAsync(new Uri(requestUrl)).ConfigureAwait(false);

            var responseBody = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

            var content = JObject.Parse(responseBody);

            var rm = content.SelectToken("$.RestaurantList").Value <JArray>().ToObject <RestaurantListResultModel[]>().ToList();

            return(rm);
        }