コード例 #1
0
        public static GameDescriptionBO GetGameDescriptionRestfulConsume(int gameId)
        {
            GameDescriptionBO tempItem = new GameDescriptionBO();
            Base myBase = new Base();

            using (WebClient webClient = new WebClient())
            {
                //Call REST service and get JSON response
                string json = webClient.DownloadString("http://localhost:60706/LotteryService/GameDescription/Item/" + gameId.ToString());
                LotteryWindowsFormsApp.BO.GameDescriptionDTO item = myBase.GetGameItem<LotteryWindowsFormsApp.BO.GameDescriptionDTO>(json);

                if (!string.IsNullOrEmpty(item.GameDescript))
                {
                    tempItem.GameName = item.GameName;
                    tempItem.GameDescript = item.GameDescript;
                    tempItem.HowToPlay = item.HowToPlay;
                    tempItem.GameCost = item.GameCost;
                }
            }
            return tempItem;
        }