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")); } }
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")); } }
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)); }
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)); }
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); }
public ActionResult Currency() { var model = new CheckAPIModel(); return(View("~/Views/Api/Currency.cshtml", model)); }
public ActionResult Dictionary() { var model = new CheckAPIModel(); return(View("~/Views/Api/Dictionary.cshtml", model)); }
public ActionResult BusStopInfo() { var model = new CheckAPIModel(); return(View("~/Views/Api/BusStopInfo.cshtml", model)); }
public ActionResult TrainTimes() { var model = new CheckAPIModel(); return(View("~/Views/Api/Travel.cshtml", model)); }