private SoloGameView GetSoloGameView(SoloGame game) => new SoloGameView { Id = game.Id, Timestamp = game.Timestamp, Username = DbContext.GetUsername(new GopUser(game.UserId, game.IpAddress)), NumberOfOrbs = game.NumberOfOrbs, Seed = game.Seed, Altar = game.Altar, Score = game.Score };
public SoloGameView Post(int numberOfOrbs, int seed, int altar, int score, string code) { var soloGame = new SoloGame { Timestamp = DateTimeOffset.Now, UserId = UserManager.GetUserIdInt32(User), IpAddress = HttpContext.Connection.RemoteIpAddress.ToString(), NumberOfOrbs = numberOfOrbs, Seed = seed, Altar = altar, Score = score, Code = code }; DbContext.SoloGames.Add(soloGame); DbContext.SaveChanges(); return(GetSoloGameView(soloGame)); }
public void ChooseGameType() { MessageService.ChooseGameTypeMessage(); switch (new ControlService().ReadIntFromConsole(new GameTypeValidator())) { case 1: var soloGame = new SoloGame(Player, MessageService); soloGame.PlayOneRound(); break; case 2: var multiPlayer = new MultiplayerGame(Player, MessageService); multiPlayer.PlayOneRound(); break; default: break; } }