Example #1
0
        public ResponseJson Get()
        {
            ResponseJson response = new ResponseJson {
                Code = -10, Message = "An exception has ocurred, please try it later."
            };
            List <Move>          list  = new List <Move>();
            List <GetMovesModel> moves = GetMovesModel.GetMoves();

            if (moves.Count > 0)
            {
                response = new ResponseJson {
                    Code = 0, Message = "OK"
                };
                foreach (GetMovesModel m in moves)
                {
                    Move move = new Move {
                        Id = m.Id, Description = m.Description, LosedAgainst = new Move {
                            Id = m.LosedAgainst
                        }, WinsAgainst = new Move {
                            Id = m.WinsAgainst
                        }
                    };
                    list.Add(move);
                }
                response.Json = Common.ToJson(list);
            }
            return(response);
        }
Example #2
0
        public ResponseJson Get()
        {
            ResponseJson response = new ResponseJson {
                Code = -10, Message = "An exception has ocurred, please, try it later"
            };
            GetGameMovesModel getGameMoves = GetGameMovesModel.GetGamePlayersMove(IdGame);

            if (getGameMoves != null)
            {
                response = new ResponseJson {
                    Code = 0, Message = "OK"
                };
                response.Json = Common.ToJson(getGameMoves);
            }
            return(response);
        }
Example #3
0
        public ResponseJson Get()
        {
            ResponseJson response = new ResponseJson {
                Code = -10, Message = "An exception has ocurred, please, try it later"
            };
            List <GetPlayersModel> getPlayers = GetPlayersModel.GetPlayersGame();

            if (getPlayers != null)
            {
                response = new ResponseJson {
                    Code = 0, Message = "OK"
                };
                response.Json = Common.ToJson(getPlayers);
            }
            return(response);
        }
Example #4
0
        public ResponseJson Create()
        {
            ResponseJson response = new ResponseJson {
                Code = -10, Message = "An exception has ocurred, please, try it later"
            };
            var newPlayer = NewPlayerModel.NewPlayer(Name, IdGame)[0];

            if (newPlayer != null)
            {
                response = new ResponseJson {
                    Code = newPlayer.Code, Message = newPlayer.Message
                };
                response.Json = Common.ToJson(newPlayer);
            }
            return(response);
        }
Example #5
0
        public ResponseJson Get()
        {
            ResponseJson response = new ResponseJson {
                Code = -10, Message = "An exception has ocurred, please, try it later"
            };
            GetDetailScoreModel getDetailScore = GetDetailScoreModel.GetGameDetailScore(PlayerOne.Id);

            if (getDetailScore != null)
            {
                response = new ResponseJson {
                    Code = 0, Message = "OK"
                };
                response.Json = Common.ToJson(getDetailScore);
            }
            return(response);
        }
Example #6
0
        public ResponseJson CheckRoundMoves(int idRound)
        {
            ResponseJson response = new ResponseJson {
                Code = -10, Message = "An exception has ocurred, please, try it later"
            };
            CheckRoundMovesModel checkRoundMovesModel = CheckRoundMovesModel.CheckGameRoundMoves(Id, idRound)[0];

            if (checkRoundMovesModel != null)
            {
                response = new ResponseJson {
                    Code = checkRoundMovesModel.Code, Message = checkRoundMovesModel.Message
                };
                response.Json = Common.ToJson(checkRoundMovesModel);
            }
            return(response);
        }
Example #7
0
        public ResponseJson Create()
        {
            ResponseJson response = new ResponseJson {
                Code = -10, Message = "An exception has ocurred, please, try it later"
            };
            bool newGameCreated = NewGameModel.NewGame();

            if (newGameCreated)
            {
                response = new ResponseJson {
                    Code = 0, Message = "OK"
                }
            }
            ;

            return(response);
        }