コード例 #1
0
        protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType)
        {
            string connectionString = ConfigurationManager.ConnectionStrings["ApplicationDbEntities"].ConnectionString;

            var repository = new SqlServerDataAccess.SqlCurrencyRepository(connectionString);

            if (controllerType == typeof(HomeController))
            {
                return(new HomeController(repository));
            }

            return(base.GetControllerInstance(requestContext, controllerType));
        }
コード例 #2
0
        public void FetchRates()
        {
            string connectionString = ConfigurationManager.ConnectionStrings["ApplicationDbEntities"].ConnectionString;

            SqlServerDataAccess.SqlCurrencyRepository repository = new SqlServerDataAccess.SqlCurrencyRepository(connectionString);
            string serviceUri = "http://www.tcmb.gov.tr/kurlar/today.xml";

            ExchangeFetcher fetcher    = new ExchangeFetcher();
            var             parsedlist = fetcher.GetExchangeRates(serviceUri);

            CurrencyService cs = new GkfxDomain.CurrencyService(repository);

            cs.UpdateInsertExchangeRates(parsedlist);

            Console.WriteLine("Exchange Rates Populated to Database : " + DateTime.Now.ToString());
        }