/// <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); }
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); }