public static GameBOCollection GetGameCollectionRestfulConsume() { GameBOCollection tempCollection = new GameBOCollection(); Base myBase = new Base(); using (WebClient webClient = new WebClient()) { //Call REST service and get JSON response string json = webClient.DownloadString("http://localhost:60706/LotteryService/Game/Collection/"); List<LotteryWindowsFormsApp.BO.GameDTO> gameCollectionList = myBase.GetGameList<LotteryWindowsFormsApp.BO.GameDTO>(json); foreach (LotteryWindowsFormsApp.BO.GameDTO item in gameCollectionList) { if (!string.IsNullOrEmpty(item.GameName)) { tempCollection.Add(new GameBO { GameId = item.GameId, GameName = item.GameName }); } else { tempCollection.Add(new GameBO { GameId = item.GameId }); } } } return tempCollection; }