public void AddUser(string UserName) { if (UsersTable.FirstOrDefault(x => x.UserName == UserName) != null) { return; } UsersTable.Add(new User() { UserName = UserName }); SaveChanges(); }
private void AddUser(long id, string name, int rating, Rank rank, int gamesPlayed) { if (id >= START_FOR_NEXT_USER_IDS) { throw new InvalidOperationException("START_FOR_NEXT_IDS too low!"); } var now = SystemClock.Instance.UtcNow(); UsersTable.Add(new DbUser { Id = id, Username = name, Rating = rating, Rank = rank.Name, GamesPlayed = gamesPlayed, CreatedAt = now }); }