示例#1
0
        /// <inheritdoc />
        public async Task <Person> GetPerson(string ssn)
        {
            Person person = null;
            DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(Person));
            Uri endpointUrl = new Uri($"{_generalSettings.GetApiBaseUrl()}persons");

            using (HttpClient client = HttpApiHelper.GetApiClient())
            {
                string ssnData = JsonConvert.SerializeObject(ssn);
                HttpResponseMessage response = await client.PostAsync(endpointUrl, new StringContent(ssnData, Encoding.UTF8, "application/json"));

                if (response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    Stream stream = await response.Content.ReadAsStreamAsync();

                    person = serializer.ReadObject(stream) as Person;
                }
                else
                {
                    _logger.LogError($"Getting person with ssn {ssn} failed with statuscode {response.StatusCode}");
                }
            }

            return(person);
        }
示例#2
0
        // DELETE: api/ApiWithActions/5
        public IActionResult Delete(int id)
        {
            string url = Environment.GetEnvironmentVariable("ApiUrl");

            url += "api/makale/MakaleDelete/" + id;
            HttpApiHelper helper   = new HttpApiHelper(url, "Delete");
            string        response = helper.GetResponse();

            return(RedirectToAction("MakaleHomePage"));
        }
示例#3
0
        public IActionResult YorumUpdaten([FromBody] Yorum yorum)
        {
            yorum.UpdatedUserId = HttpContext.User.Identity.Name;
            string url = Environment.GetEnvironmentVariable("ApiUrl");

            url += "api/yorum/YorumUpdate/";
            HttpApiHelper helper   = new HttpApiHelper(url, "PUT");
            string        response = helper.GetResponseWithModel(JsonConvert.SerializeObject(yorum));

            return(RedirectToAction("MakaleGet", "Makale", new { id = yorum.MakaleId }));
        }
示例#4
0
 public ActionResult Config()
 {
     try
     {
         var str = HttpRequestHelper.GetRequest(HttpApiHelper.CreateHttpApiCall(CustomConfig.ApiQuote, "config"), null);
         return(Content(str));
     }
     catch
     {
     }
     return(Content(""));
 }
示例#5
0
        // GET: api/Kategori
        public IActionResult GetKategori()
        {
            string url = Environment.GetEnvironmentVariable("ApiUrl");

            url += "api/kategori/GetKategoriData";
            HttpApiHelper helper   = new HttpApiHelper(url, "GET");
            string        response = helper.GetResponse();

            IEnumerable <Kategori> kategori = JsonConvert.DeserializeObject <IEnumerable <Kategori> >(response);

            return(View(kategori));
        }
示例#6
0
        public IActionResult MakaleAdd(Makale makale)
        {
            makale.CreatedUserId = HttpContext.User.Identity.Name;
            string url = Environment.GetEnvironmentVariable("ApiUrl");

            url += "api/makale/PostMakale/";
            HttpApiHelper helper   = new HttpApiHelper(url, "POST");
            string        response = helper.GetResponseWithModel(JsonConvert.SerializeObject(makale));

            //Makale makaleadd = JsonConvert.DeserializeObject<Makale>(response);
            return(RedirectToAction("MakaleHomePage"));
        }
示例#7
0
        // PUT: api/Makale/5
        public IActionResult MakaleUpdate(int id)
        {
            string url = Environment.GetEnvironmentVariable("ApiUrl");

            url += "api/makale/GetMakale/" + id;
            HttpApiHelper helper   = new HttpApiHelper(url, "GET");
            string        response = helper.GetResponse();

            Makale makale = JsonConvert.DeserializeObject <Makale>(response);

            return(View(makale));
        }
示例#8
0
        // PUT: api/Yorum/
        public IActionResult YorumUpdate([FromBody] int id)
        {
            string url = Environment.GetEnvironmentVariable("ApiUrl");

            url += "api/yorum/GetYorum/" + id;
            HttpApiHelper helper   = new HttpApiHelper(url, "GET");
            string        response = helper.GetResponse();

            Yorum makale = JsonConvert.DeserializeObject <Yorum>(response);

            return(View());
        }
示例#9
0
        // GET: api/Makale
        public IActionResult MakaleHomePage()
        {
            string url = Environment.GetEnvironmentVariable("ApiUrl");

            url += "api/makale/GetMakaleData";
            HttpApiHelper helper   = new HttpApiHelper(url, "GET");
            string        response = helper.GetResponse();

            ViewBag.User = HttpContext.User.Identity.Name;
            IEnumerable <Makale> makale = JsonConvert.DeserializeObject <IEnumerable <Makale> >(response);

            return(View(makale));
        }
示例#10
0
 public ActionResult Symbol_info(string group)
 {
     try
     {
         Dictionary <string, object> parms = new Dictionary <string, object>();
         parms.Add("group", group);
         var str = HttpRequestHelper.GetRequest(HttpApiHelper.CreateHttpApiCall(CustomConfig.ApiQuote, "symbol_info"), null);
         return(Content(str));
     }
     catch
     {
     }
     return(Content(""));
 }
示例#11
0
        /// <summary>
        /// 针对拜伦财经的接口推送
        /// </summary>
        /// <param name="marketId">市场中心的详情ID</param>
        /// <returns></returns>
        public ReturnModel GetChatIndexForBailun()
        {
            var rm = new ReturnModel();

            try
            {
                rm = HttpRequestHelper.GetRequest <ReturnModel>(HttpApiHelper.CreateHttpApiCall(CustomConfig.ApiQuote, apiQuoteSubscriber, "GetChatIndexForBailun"), null);
            }
            catch (Exception ex)
            {
                rm.bodyMessage = "[{\"SubscriberId\":100009,\"MarketId\":1,\"Code\":\"EUR.USD\",\"Description\":\"European Monetary Union Euro\",\"Symbol\":\"EUR\",\"Currency\":\"USD\",\"ContractType\":\"CASH\",\"Exchange\":\"IDEALPRO\",\"Cn_Name\":\"欧元/美元\",\"En_Name\":\"EURUSD\",\"ConId\":\"100009\",\"DecimalPoint\":7,\"Ask\":\"1.11103\",\"Bid\":\"1.11099\",\"Pre_Close\":\"1.10830\",\"High\":\"1.11135\",\"Low\":\"1.10800\"},{\"SubscriberId\":100041,\"MarketId\":1,\"Code\":\"GBP.USD\",\"Description\":\"British pound\",\"Symbol\":\"GBP\",\"Currency\":\"USD\",\"ContractType\":\"CASH\",\"Exchange\":\"IDEALPRO\",\"Cn_Name\":\"英镑/美元\",\"En_Name\":\"GBPUSD\",\"ConId\":\"100041\",\"DecimalPoint\":7,\"Ask\":\"1.29195\",\"Bid\":\"1.29191\",\"Pre_Close\":\"1.29180\",\"High\":\"1.29265\",\"Low\":\"1.29115\"},{\"SubscriberId\":100058,\"MarketId\":1,\"Code\":\"USD.JPY\",\"Description\":\"United States dollar\",\"Symbol\":\"USD\",\"Currency\":\"JPY\",\"ContractType\":\"CASH\",\"Exchange\":\"IDEALPRO\",\"Cn_Name\":\"美元/日元\",\"En_Name\":\"USDJPY\",\"ConId\":\"100058\",\"DecimalPoint\":7,\"Ask\":\"112.478\",\"Bid\":\"112.474\",\"Pre_Close\":\"113.120\",\"High\":\"113.255\",\"Low\":\"112.425\"},{\"SubscriberId\":100061,\"MarketId\":1,\"Code\":\"AUD.USD\",\"Description\":\"Australian dollar\",\"Symbol\":\"AUD\",\"Currency\":\"USD\",\"ContractType\":\"CASH\",\"Exchange\":\"IDEALPRO\",\"Cn_Name\":\"澳元/美元\",\"En_Name\":\"AUDUSD\",\"ConId\":\"100061\",\"DecimalPoint\":7,\"Ask\":\"0.74148\",\"Bid\":\"0.74145\",\"Pre_Close\":\"0.74265\",\"High\":\"0.74320\",\"Low\":\"0.74110\"},{\"SubscriberId\":100029,\"MarketId\":1,\"Code\":\"USD.CAD\",\"Description\":\"United States dollar\",\"Symbol\":\"USD\",\"Currency\":\"CAD\",\"ContractType\":\"CASH\",\"Exchange\":\"IDEALPRO\",\"Cn_Name\":\"美元/加元\",\"En_Name\":\"USDCAD\",\"ConId\":\"100029\",\"DecimalPoint\":7,\"Ask\":\"1.36054\",\"Bid\":\"1.36050\",\"Pre_Close\":\"1.36070\",\"High\":\"1.36190\",\"Low\":\"1.36040\"},{\"SubscriberId\":100019,\"MarketId\":1,\"Code\":\"USD.CNH\",\"Description\":\"United States dollar\",\"Symbol\":\"USD\",\"Currency\":\"CNH\",\"ContractType\":\"CASH\",\"Exchange\":\"IDEALPRO\",\"Cn_Name\":\"美元/人民币\",\"En_Name\":\"USDCNH\",\"ConId\":\"100019\",\"DecimalPoint\":7,\"Ask\":\"6.87588\",\"Bid\":\"6.87587\",\"Pre_Close\":\"6.87550\",\"High\":\"6.87885\",\"Low\":\"6.87205\"},{\"SubscriberId\":100092,\"MarketId\":1,\"Code\":\"XAGUSD\",\"Description\":\"London Good Delivery\",\"Symbol\":\"XAGUSD\",\"Currency\":\"USD\",\"ContractType\":\"CMDTY\",\"Exchange\":\"SMART\",\"Cn_Name\":\"白银\",\"En_Name\":\"XAGUSD\",\"ConId\":\"100092\",\"DecimalPoint\":8,\"Ask\":\"16.90200\",\"Bid\":\"16.90000\",\"Pre_Close\":\"16.81000\",\"High\":\"16.94350\",\"Low\":\"16.82500\"},{\"SubscriberId\":100093,\"MarketId\":1,\"Code\":\"XAUUSD\",\"Description\":\"London Good Delivery\",\"Symbol\":\"XAUUSD\",\"Currency\":\"USD\",\"ContractType\":\"CMDTY\",\"Exchange\":\"SMART\",\"Cn_Name\":\"黄金\",\"En_Name\":\"XAUUSD\",\"ConId\":\"100093\",\"DecimalPoint\":8,\"Ask\":\"1243.850\",\"Bid\":\"1243.780\",\"Pre_Close\":\"1236.800\",\"High\":\"1245.120\",\"Low\":\"1236.600\"}]";
            }
            return(rm);
        }
示例#12
0
 public ActionResult Symbols(string symbol)
 {
     try
     {
         Dictionary <string, object> parms = new Dictionary <string, object>();
         parms.Add("symbol", HttpUtility.UrlEncode(symbol));
         var str = HttpRequestHelper.GetRequest(HttpApiHelper.CreateHttpApiCall(CustomConfig.ApiQuote, "symbols"), parms);
         return(Content(str));
     }
     catch
     {
     }
     return(Content(""));
 }
示例#13
0
        /// <summary>
        /// 获取国家集合
        /// </summary>
        /// <returns></returns>
        public ReturnModel GetCountryBannerList()
        {
            var rm = new ReturnModel();

            try
            {
                Dictionary <string, object> parms = new Dictionary <string, object>();
                rm = HttpRequestHelper.GetRequest <ReturnModel>(HttpApiHelper.CreateHttpApiCall(CustomConfig.ApiMacroeData, apiNeedIndicatorList), parms);
            }
            catch (Exception ex)
            {
                rm.bodyMessage = ex.Message;
            }
            return(rm);
        }
示例#14
0
        /// <summary>
        /// 获取首页各国经济数据
        /// </summary>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public ReturnModel GetIndexGlobelIndicator()
        {
            var rm = new ReturnModel();

            try
            {
                Dictionary <string, object> parms = new Dictionary <string, object>();
                rm = HttpRequestHelper.GetRequest <ReturnModel>(HttpApiHelper.CreateHttpApiCall(CustomConfig.ApiMacroeData, apiWallsSummary), parms);
            }
            catch (Exception ex)
            {
                rm.bodyMessage = ex.Message;
            }
            return(rm);
        }
示例#15
0
        /// <summary>
        /// 获得品种详情信息
        /// </summary>
        /// <param name="plate"></param>
        /// <param name="pagesize"></param>
        /// <param name="pageindex"></param>
        /// <returns></returns>
        public ReturnModel GetQueryMarketDetail(int marketid)
        {
            var rm = new ReturnModel();

            try
            {
                Dictionary <string, object> parms = new Dictionary <string, object>();
                parms.Add("marketid", marketid);
                rm = HttpRequestHelper.GetRequest <ReturnModel>(HttpApiHelper.CreateHttpApiCall(CustomConfig.ApiQuote, apiQueryQuote, "QueryMarketDetail"), parms);
            }
            catch (Exception ex)
            {
                rm.bodyMessage = ex.Message;
            }
            return(rm);
        }
示例#16
0
        /// <summary>
        /// 根据ID获取经济指标详情数据
        /// </summary>
        /// <param name="mainItemId"></param>
        /// <returns></returns>
        public ReturnModel GetEcoItemDetails(string mainItemId)
        {
            var rm = new ReturnModel();

            try
            {
                Dictionary <string, object> parms = new Dictionary <string, object>();
                parms.Add("mainItemId", mainItemId);
                rm = HttpRequestHelper.GetRequest <ReturnModel>(HttpApiHelper.CreateHttpApiCall(CustomConfig.ApiMacroeData, apiGetEcoItemDetails), parms);
            }
            catch (Exception ex)
            {
                rm.bodyMessage = ex.Message;
            }
            return(rm);
        }
示例#17
0
        /// <summary>
        /// 获取国家对应的经济指标集合(不分大项)
        /// </summary>
        /// <param name="countryId"></param>
        /// <param name="addpar"></param>
        /// <returns></returns>
        public ReturnModel GetIndicaByCountryId(int countryId)
        {
            var rm = new ReturnModel();

            try
            {
                Dictionary <string, object> parms = new Dictionary <string, object>();
                parms.Add("countryId", countryId);
                rm = HttpRequestHelper.GetRequest <ReturnModel>(HttpApiHelper.CreateHttpApiCall(CustomConfig.ApiMacroeData, apiIndicaByCountryId), parms);
            }
            catch (Exception ex)
            {
                rm.bodyMessage = ex.Message;
            }
            return(rm);
        }
示例#18
0
        public JsonResult CheckInvitationCode(string invitationCode)
        {
            var rm = new ReturnModel();

            try
            {
                Dictionary <string, object> parms = new Dictionary <string, object>();
                parms.Add("invitationCode", invitationCode);
                rm = HttpRequestHelper.GetRequest <ReturnModel>(HttpApiHelper.CreateHttpApiCall(CustomConfig.ApiMaster, "BailunBetaApi", "CheckInvitationCodeSendSms"), parms);
            }
            catch (Exception ex)
            {
                rm.bodyMessage = ex.Message;
            }

            return(Json(rm));
        }
示例#19
0
        /// <summary>
        /// 清除短信验证码
        /// </summary>
        /// <param name="sendType">发送类型</param>
        /// <param name="phone">手机号</param>
        /// <returns></returns>
        public ReturnModel ClearSmsVcode(short sendType, string phone)
        {
            var rm = new ReturnModel();

            try
            {
                Dictionary <string, object> parms = new Dictionary <string, object>();
                parms.Add("sendType", sendType);
                parms.Add("telephone", phone);
                rm = HttpRequestHelper.GetRequest <ReturnModel>(HttpApiHelper.CreateHttpApiCall(CustomConfig.ApiBaseService, apiSmsController, "ClearSMSRecord"), parms);
            }
            catch (Exception ex)
            {
                rm.bodyMessage = ex.Message;
            }
            return(rm);
        }
示例#20
0
        /// <summary>
        /// 获取报名信息
        /// </summary>
        /// <param name="regType"></param>
        /// <param name="mobile"></param>
        /// <returns></returns>
        public ReturnModel GetRegisterByRegTypeMobileRm(int regType, string mobile)
        {
            var rm = new ReturnModel();

            try
            {
                Dictionary <string, object> parms = new Dictionary <string, object>();
                parms.Add("regType", regType);
                parms.Add("mobile", mobile);
                rm = HttpRequestHelper.GetRequest <ReturnModel>(HttpApiHelper.CreateHttpApiCall(CustomConfig.ApiMaster, apiRegisterInfo, "GetRegisterByRegTypeMobile"), parms);
            }
            catch (Exception ex)
            {
                rm.bodyMessage = ex.Message;
            }
            return(rm);
        }
示例#21
0
        /// <summary>
        /// 获取所有站点最新指定条数财经快讯
        /// </summary>
        /// <param name="topSize">单一网站获取条数</param>
        /// <returns></returns>
        public ReturnModel GetFinanceAllBrief(int topSize)
        {
            var rm = new ReturnModel();

            try
            {
                Dictionary <string, object> parms = new Dictionary <string, object>();
                parms.Add("topSize", topSize);

                rm = HttpRequestHelper.GetRequest <ReturnModel>(HttpApiHelper.CreateHttpApiCall(CustomConfig.ApiBailunNews, apiFinanceNews, "GetNewBriefByTopSize"), parms);
            }
            catch (Exception ex)
            {
                rm.bodyMessage = ex.Message;
            }
            return(rm);
        }
示例#22
0
        /// <summary>
        /// 获取首页各国经济数据ID
        /// </summary>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public ReturnModel GetIndexGlobelIndicatorId(/*int pagesize = 1, int pageIndex = 100*/)
        {
            var rm = new ReturnModel();

            try
            {
                Dictionary <string, object> parms = new Dictionary <string, object>();
                //parms.Add("pagesize", pagesize);
                //parms.Add("pageIndex", pageIndex);
                rm = HttpRequestHelper.GetRequest <ReturnModel>(HttpApiHelper.CreateHttpApiCall(CustomConfig.ApiMacroeData, apiIndicatorItems), parms);
            }
            catch (Exception ex)
            {
                rm.bodyMessage = ex.Message;
            }
            return(rm);
        }
示例#23
0
 public ActionResult Search(string limit, string query, string type, string exchange)
 {
     try
     {
         Dictionary <string, object> parms = new Dictionary <string, object>();
         parms.Add("limit", limit);
         parms.Add("query", query);
         parms.Add("type", type);
         parms.Add("exchange", exchange);
         var str = HttpRequestHelper.GetRequest(HttpApiHelper.CreateHttpApiCall(CustomConfig.ApiQuote, "search"), parms);
         return(Content(str));
     }
     catch
     {
     }
     return(Content(""));
 }
示例#24
0
 public ActionResult Timescale_marks(string symbol, string from, string to, string resolution)
 {
     try
     {
         Dictionary <string, object> parms = new Dictionary <string, object>();
         parms.Add("symbol", symbol);
         parms.Add("from", from);
         parms.Add("to", to);
         parms.Add("resolution", resolution);
         var str = HttpRequestHelper.GetRequest(HttpApiHelper.CreateHttpApiCall(CustomConfig.ApiQuote, "timescale_marks"), parms);
         return(Content(str));
     }
     catch
     {
     }
     return(Content(""));
 }
示例#25
0
        /// <summary>
        ///  //获取金十数据详细介绍
        /// </summary>
        /// <returns></returns>
        public ReturnModel GetIntroduceInfo(int rctype, int rcountryId)
        {
            var rm = new ReturnModel();

            try
            {
                Dictionary <string, object> parms = new Dictionary <string, object>();
                parms.Add("rctype", rctype);
                parms.Add("rcountryId", rcountryId);
                rm = HttpRequestHelper.GetRequest <ReturnModel>(HttpApiHelper.CreateHttpApiCall(CustomConfig.ApiMacroeData, apiReportList), parms);
            }
            catch (Exception ex)
            {
                rm.bodyMessage = ex.Message;
            }
            return(rm);
        }
示例#26
0
        /// <summary>
        /// 市场报价首页重要品种的产品ID列表信息获取
        /// </summary>
        /// <param name="pageindex"></param>
        /// <param name="pagesize"></param>
        /// <returns></returns>
        public ReturnModel GetQueryRecommendProduct(int pageindex, int pagesize)
        {
            var rm = new ReturnModel();

            try
            {
                Dictionary <string, object> parms = new Dictionary <string, object>();
                parms.Add("pageindex", pageindex);
                parms.Add("pagesize", pagesize);
                rm = HttpRequestHelper.GetRequest <ReturnModel>(HttpApiHelper.CreateHttpApiCall(CustomConfig.ApiQuote, apiQuoteQueryImportant, "Query_RecommendProduct"), parms);
            }
            catch (Exception ex)
            {
                rm.bodyMessage = ex.Message;
            }
            return(rm);
        }
示例#27
0
        /// <summary>
        /// 获取分时数据
        /// </summary>
        /// <param name="marketid"></param>
        /// <returns></returns>
        public ReturnModel GetHistoryreconnect(string symbol, int resolution)
        {
            var rm = new ReturnModel();

            try
            {
                Dictionary <string, object> parms = new Dictionary <string, object>();
                parms.Add("symbol", symbol);
                parms.Add("resolution", resolution);
                rm = HttpRequestHelper.GetRequest <ReturnModel>(HttpApiHelper.CreateHttpApiCall(CustomConfig.ApiQuote, "historyreconnect"), parms);
            }
            catch (Exception ex)
            {
                rm.bodyMessage = ex.Message;
            }
            return(rm);
        }
示例#28
0
        /// <summary>
        /// 获取指定时间之后财经快讯
        /// </summary>
        /// <param name="currentTime">13位时间戳</param>
        /// <returns></returns>
        public ReturnModel GetFinanceBriefByTime(long currentTime)
        {
            var rm = new ReturnModel();

            try
            {
                Dictionary <string, object> parms = new Dictionary <string, object>();
                parms.Add("currentTime", currentTime);

                rm = HttpRequestHelper.GetRequest <ReturnModel>(HttpApiHelper.CreateHttpApiCall(CustomConfig.ApiBailunNews, apiFinanceNews, "GetBriefByTimeBack"), parms);
            }
            catch (Exception ex)
            {
                rm.bodyMessage = ex.Message;
            }
            return(rm);
        }
示例#29
0
        /// <summary>
        /// 获取首页各国经济数据chart
        /// </summary>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public ReturnModel GetIndexGlobelIndicatorChart(int country, int type, int sp)
        {
            var rm = new ReturnModel();

            try
            {
                Dictionary <string, object> parms = new Dictionary <string, object>();
                parms.Add("country", country);
                parms.Add("type", type);
                parms.Add("sp", sp);
                rm = HttpRequestHelper.PostRequest <ReturnModel>(HttpApiHelper.CreateHttpApiCall(CustomConfig.ApiMacroeData, apiKlineGraph), parms);
            }
            catch (Exception ex)
            {
                rm.bodyMessage = ex.Message;
            }
            return(rm);
        }
示例#30
0
        /// <summary>
        /// 根据产品获得该产品下面的品种板块有哪些(主要针对的是股票)
        /// </summary>
        /// <param name="plate"></param>
        /// <param name="pagesize"></param>
        /// <param name="pageindex"></param>
        /// <returns></returns>
        public ReturnModel GetQueryMarketByPlate(int plate, int pagesize, int pageindex)
        {
            var rm = new ReturnModel();

            try
            {
                Dictionary <string, object> parms = new Dictionary <string, object>();
                parms.Add("plate", plate);
                parms.Add("pagesize", pagesize);
                parms.Add("pageindex", pageindex);
                rm = HttpRequestHelper.GetRequest <ReturnModel>(HttpApiHelper.CreateHttpApiCall(CustomConfig.ApiQuote, apiQuoteQueryPlate, "QueryMarketByPlate"), parms);
            }
            catch (Exception ex)
            {
                rm.bodyMessage = ex.Message;
            }
            return(rm);
        }