예제 #1
0
        public void CreatePlayer(Guid userId, string username, string password)
        {
            using (var context = new GameServerEntities())
            {
                var player = new Player
                {
                    id       = userId,
                    username = username,
                    password = password,
                };

                context.Players.Add(player);
                context.SaveChanges();
            }
        }
예제 #2
0
 public void StoreMatch(MatchState matchState)
 {
     using (var context = new GameServerEntities())
     {
         var players  = context.Players.Where(x => matchState.players.Contains(x.id)).ToList();
         var matchRow = ModelConverter.ToRow.GetMatchFromMatchState(matchState);
         if (players.Count == 0)
         {
             throw new EmptyResultsException();
         }
         matchRow.Players = players;
         context.Matches.Add(matchRow);
         context.SaveChanges();
     }
 }