Exemplo n.º 1
0
 public static void Execute(Game game)
 {
     using (var context = new MonopolyDotNetDbContext())
       {
     context.Games.Attach(game);
     game.BuyProperty();
     context.SaveChanges();
       }
 }
Exemplo n.º 2
0
 public static void Execute(string username, NewGameData newGameData)
 {
     using (var context = new MonopolyDotNetDbContext())
       {
     var game = new Game(newGameData, username);
     context.Games.Add(game);
     context.SaveChanges();
       }
 }
Exemplo n.º 3
0
        public static GameStatusViewModel Flatten(Game game)
        {
            var vm = new GameStatusViewModel();

              var gameStatus = game.GetCurrentGameStatus();
              vm.PlayerStatuses.AddRange(gameStatus.Players.Select(player => Convert(player)).OrderBy(x=>x.PlayerNumber));
              vm.CanRoll = gameStatus.CanRoll;
              vm.CanBuyProperty = gameStatus.CanBuyProperty;
              vm.CanEndTurn = gameStatus.CanEndTurn;
              vm.PropertySalePrice = CashHelper.FormatAsCash(gameStatus.PropertySalePrice);

              return vm;
        }
Exemplo n.º 4
0
 public ActionResult Roll(Game game)
 {
     RollDiceCommand.Execute(game);
       return this.RedirectToAction<HomeController>(x => x.Index());
 }
Exemplo n.º 5
0
 public ActionResult Index(Game game)
 {
     var gameStatus = GameFormatter.Flatten(game);
       return View(gameStatus);
 }
Exemplo n.º 6
0
 public ActionResult BuyProperty(Game game)
 {
     BuyPropertyCommand.Execute(game);
       return this.RedirectToAction<HomeController>(x => x.Index());
 }