예제 #1
0
        public async Task <string> Get(int id)
        {
            switch (id)
            {
            case 1: return(await _dataAccess.GetDataAsync_V1());

            case 2: return(await _dataAccess.GetDataAsync_V2());

            case 3: return(await _dataAccess.GetDataAsync_V3());

            case 4: return(await _dataAccess.GetDataAsync_V4());
            }
            return("Try again");
        }
예제 #2
0
        static async Task Main(string[] args)
        {
            var dal = new AsyncDataAccessWrapper();

            while (true)
            {
                System.Console.Write("Give me a number or \"exit\": ");
                var num = System.Console.ReadLine();
                switch (num)
                {
                case "1": await dal.GetDataAsync_V1(); Ok(); break;

                case "2": await dal.GetDataAsync_V2(); Ok(); break;

                case "3": await dal.GetDataAsync_V3(); Ok(); break;

                case "4": await dal.GetDataAsync_V4(); Ok(); break;

                case "exit": return;

                default: TryAgain(); break;
                }
            }
        }