コード例 #1
0
        public void HashTagConvertedCorrectly(string before, string after)
        {
            var hasher = new LocationHashTag(before);

            var result = hasher.ToString();

            Assert.AreEqual(after, result);
        }
コード例 #2
0
ファイル: ValuesController.cs プロジェクト: PySom/emichoice
        //public async Task<ActionResult> Get(string type, string term, int limit, string source_popularity, string fallback_popularity)
        public async Task <ActionResult> Get([FromQuery] LocationHashTag model)
        {
            //set the message
            var request = new HttpRequestMessage(HttpMethod.Get, BaseUrl);

            request.Headers.Add("Accept", "application/json");
            //string extra = $"locations?type={type}&term={term}&limit={limit}&source_popularity={source_popularity}&fallback_popularity={fallback_popularity}";
            HttpContent content = new StringContent(model.ToJson());

            request.Content = content;
            var httpRequest = _client.CreateClient();
            var response    = await httpRequest.SendAsync(request);

            if (response.IsSuccessStatusCode)
            {
                var result = await response.Content.ReadAsStringAsync();

                return(Ok(result));
            }
            return(BadRequest());
        }