示例#1
0
        /// <summary>
        /// Method to write the information from API to different destinations
        /// </summary>
        public void DisplayMessage()
        {
            switch (ConfigurationManager.AppSettings.Get("outputType"))
            {
            case "console":
                Console.WriteLine(_service.GetMessage(ConfigurationManager.AppSettings.Get("HelloWorldApiUrl")).Result);
                break;

            case "database":
                _service.InsertMessageIntoDatabase(ConfigurationManager.ConnectionStrings["DBConnectionString"].ConnectionString);
                break;

            default:
                Console.WriteLine("The write method specified is not supported by this application");
                break;
            }
        }