Esempio n. 1
0
        public Player Create(Player newPlayer)
        {
            int id = _repo.Create(newPlayer);

            newPlayer.Id = id;
            return(newPlayer);
        }
        public async Task Register()
        {
            Player player = new Player();

            player.Id         = Context.User.Id.ToString();
            player.Health     = 1000;
            player.MaxHealth  = 1000;
            player.GameStatus = Player.PlayerGameStatus.Idle;
            await PlayersRepository.Create(player);

            await Context.User.SendMessageAsync("You have successfully registered! Make sure to pick a Class!");
        }
        public async Task CreatesPlayer()
        {
            using (var context = new ApplicationDbContext(_options))
            {
                var playersRepository = new PlayersRepository(context);

                await playersRepository.Create(new Player { Id = 1 });
            }

            using (var context = new ApplicationDbContext(_options))
            {
                Assert.Equal(1, context.Players.Count());
                Assert.Equal(1, context.Players.Single().Id);
            }
        }
Esempio n. 4
0
 internal Player Create(Player newData)
 {
     _repo.Create(newData);
     return(newData);
 }
Esempio n. 5
0
        public IHttpActionResult Post([FromBody] Player player)
        {
            var newPlayer = _repo.Create(player);

            return(Created(new Uri($"{Request.RequestUri}/{newPlayer.PlayerId}"), newPlayer));
        }