Пример #1
0
 public GameTableModel GetById(int tableId)
 {
     using (GameTableManagementServiceClient proxy = new GameTableManagementServiceClient()) {
         var serviceGameTable = proxy.GetGameTableById(tableId);
         Models.GameTableModel clientGameTable = GameTableModelConverter.ConvertFromServiceGameTableToClientGameTable(serviceGameTable);
         return(clientGameTable);
     }
 }
 internal static Models.GameTableModel ConvertFromServiceGameTableToClientGameTable(GameTableServiceReference.GameTable serviceGameTable)
 {
     Models.GameTableModel clientGameTable = new Models.GameTableModel()
     {
         Id        = serviceGameTable.Id,
         TableName = serviceGameTable.TableName,
         Users     = ConvertFromServiceListOfUsersToClientListOfUsers(serviceGameTable.Users),
     };
     return(clientGameTable);
 }
        public static List <Models.GameTableModel> ConvertFromServiceGameTablesToClientGameTables(IEnumerable <GameTableServiceReference.GameTable> serviceGameTables)
        {
            List <Models.GameTableModel> clientGameTables = new List <Models.GameTableModel>();

            foreach (GameTableServiceReference.GameTable sgt in serviceGameTables)
            {
                Models.GameTableModel mgt = ConvertFromServiceGameTableToClientGameTable(sgt);
                clientGameTables.Add(mgt);
            }
            return(clientGameTables);
        }