Example #1
0
        public ActionResult DictionaryApi(CheckAPIModel model)
        {
            try
            {
                model.DictionaryData = new ApiHelper().GetSearchedWord(model.WordToSearch);

                return(View("~/Views/Api/Dictionary.cshtml", model));
            }
            catch (Exception)
            {
                return(View("~/Views/Shared/Error.cshtml"));
            }
        }
Example #2
0
        public ActionResult CurrencyApi(CheckAPIModel model)
        {
            try
            {
                var bla = new ApiHelper().GetCurrency(model);
                model.CurrencyList = GetCurrencyList();

                return(View("~/Views/Api/Currency.cshtml", model));
            }
            catch (Exception)
            {
                return(View("~/Views/Shared/Error.cshtml"));
            }
        }
Example #3
0
        public ActionResult BusStopInfoApi(CheckAPIModel model)
        {
            try
            {
                if (model.BusStation != null) //make new class to call for APIs
                {
                    model.BusData = new ApiHelper().GetBusTimes(model.BusStation);
                }
            }
            catch (Exception)
            {
                return(View("~/Views/Shared/Error.cshtml"));
            }

            return(View("~/Views/Api/BusStopInfo.cshtml", model));
        }
Example #4
0
        public ActionResult TrainTimesApi(CheckAPIModel model)
        {
            try
            {
                if (model.TrainStation != null) //make new class to call for APIs
                {
                    model.TrainData = new ApiHelper().GetTrainData(model.TrainStation);
                }
            }
            catch (Exception)
            {
                return(View("~/Views/Shared/Error.cshtml"));
            }

            return(View("~/Views/Api/Travel.cshtml", model));
        }
Example #5
0
        public ActionResult NewsApi()
        {
            try
            {
                var mod = new ApiHelper().GetNews();

                CheckAPIModel model = new CheckAPIModel();
                model.NewsData = mod;

                return(View("~/Views/Api/News.cshtml", model));
            }
            catch (Exception)
            {
                return(View("~/Views/Shared/Error.cshtml"));
            }
        }
        public string GetCurrency(CheckAPIModel model)
        {
            var curFrom = model.CurrencyFrom;
            var curTo   = model.CurrencyTo;
            var amt     = model.AmmountToConvert.ToString();
            var st      = "https://currency-converter5.p.rapidapi.com/currency/convert?format=json&from=" + curFrom + "&to=" + curTo + "&amount=" + amt;
            var client  = new RestClient(st);
            var request = new RestRequest(Method.GET);

            request.AddHeader("x-rapidapi-host", "currency-converter5.p.rapidapi.com");
            request.AddHeader("x-rapidapi-key", "7d8d99d373mshc3117de52882fb3p1e2c5djsnac4bb85ece25");
            IRestResponse response = client.Execute(request);

            dynamic data    = JObject.Parse(response.Content);
            var     ba      = data.rates.Value; //FIX ME rates { key, value [values ]}
            var     userObj = JsonConvert.DeserializeObject <ApiCurrencyConverterModel>(ba);



            return(null);
        }
Example #7
0
        public ActionResult Currency()
        {
            var model = new CheckAPIModel();

            return(View("~/Views/Api/Currency.cshtml", model));
        }
Example #8
0
        public ActionResult Dictionary()
        {
            var model = new CheckAPIModel();

            return(View("~/Views/Api/Dictionary.cshtml", model));
        }
Example #9
0
        public ActionResult BusStopInfo()
        {
            var model = new CheckAPIModel();

            return(View("~/Views/Api/BusStopInfo.cshtml", model));
        }
Example #10
0
        public ActionResult TrainTimes()
        {
            var model = new CheckAPIModel();

            return(View("~/Views/Api/Travel.cshtml", model));
        }