ArmedCards.BusinessLogic.AppServices.Game.Start.Execute C# (CSharp) Method

Execute() public method

Starts a game if certain requirements are met
public Execute ( Int32 gameID, Entities commander ) : Entities.Game
gameID System.Int32 The ID for the game to start
commander Entities The commander for the first round
return Entities.Game
        public Entities.Game Execute(Int32 gameID, Entities.User commander)
        {
            Entities.Filters.Game.Select filter = new Entities.Filters.Game.Select();
            filter.GameID = gameID;
            filter.DataToSelect = Entities.Enums.Game.Select.GamePlayerCards;

            Entities.Game game = _selectGame.Execute(filter);

            Entities.GamePlayer host = game.Players.First();

            if (game.IsCurrentCommander(commander.UserId))
            {
                Boolean successful = _startRound.Execute(game, commander);

                if (successful)
                {
                    _sendMessage.UpdateGame(game, true);
                }
            }

            return game;
        }