public ActionResult Create(CityPostModel model)
        {
            var cityModel = _mapper.Map <CityModel>(model);

            _cityService.Create(cityModel);
            return(new EmptyResult());
        }
Пример #2
0
        public async Task <string> SysCity([FromBody] CityPostModel postModel)
        {
            if (ModelState.IsValid)
            {
                var headers        = new Dictionary <string, string>();
                var tokenGenerated = HttpContext.Session.GetHmacToken();
                headers.Add("X-Hmac", tokenGenerated);
                headers.Add("X-PublicKey", HttpContext.Session.GetUserPublicKey());
                string queryStr = _queryCreater.GetQueryStringFromObject(postModel);
                var    response = await HttpClientRequestFactory.Get("http://proxy.mansis.co.za:18443/SlimProxyBoot.php?" + queryStr, headers);

                var data = response.Content.ReadAsStringAsync().Result;
                return(data.ToString());
            }
            else
            {
                throw new Exception("Model satate is not valid");
            }
        }