예제 #1
0
        /// <summary>
        ///     Before the update in DB, check it the data is consistant.
        /// </summary>
        /// <param name="nPins"> Number of pins knocked. </param>
        private void tryUpdateModel(int nPins)
        {
            string     scoreString = DbFileController.Load();
            List <int> rolls       = Tools.Parser.GetIntegers(scoreString);
            Game       game        = new Game(rolls);

            // Throw an exception if the model is invalid.
            game.PinsKnocked(nPins);
        }
예제 #2
0
        private ActionResult <APIGameResults> scoresController()
        {
            string     scoreString = DbFileController.Load();
            List <int> rolls       = Tools.Parser.GetIntegers(scoreString);
            Game       game        = new Game(rolls);
            var        apiResults  = new APIGameResults(game.GetFramesScore().ToArray());

            return(apiResults);
        }