Exemple #1
0
        public EverythingVM CreateNewGame(string LoginID)
        {
            var vm = new EverythingVM();

            var player = new Player();

            player.PizzaAmount = 0;
            player.LoginID     = LoginID;
            player.DateCreated = DateTime.Now;

            var id = playerrepo.Save(player);

            //player.PlayerID = playerrepo.All().Max(m => m.PlayerID);

            buildrepo.StartBuildings(id.PlayerID.ToString());
            upgraderepo.StartUpgrades(id.PlayerID.ToString());
            var startingUpgrades  = upgraderepo.GrabUpgrades(id.PlayerID.ToString());
            var startingbuildings = buildrepo.GrabBuildings(id.PlayerID.ToString());

            vm.Player         = player;
            vm.TotalBuildings = startingbuildings;
            vm.AllUpgrades    = startingUpgrades;

            //vm = CurrentPPS(vm);
            vm.PPS = 0;
            return(vm);
        }