Exemplo n.º 1
0
        public void AddUserServerJunction(User user)
        {
            if (user.IsOnServers == null)
            {
                user.IsOnServers = new List <UserServerJunction>();
            }
            if (AreOnServer == null)
            {
                AreOnServer = new List <UserServerJunction>();
            }
            //null poiter exception fix

            if (AreOnServer.Exists(
                    junction => junction.User.Id == user.Id)
                )
            {
                return;
            }
            //this connection already exists

            var junction = new UserServerJunction()
            {
                User   = user,
                Server = this
            };

            //create new junction

            user.IsOnServers.Add(junction);
            AreOnServer.Add(junction);
        }
Exemplo n.º 2
0
        public void AddUserServerJunction(Server server)
        {
            if (IsOnServers == null)
            {
                IsOnServers = new List <UserServerJunction>();
            }
            if (server.AreOnServer == null)
            {
                server.AreOnServer = new List <UserServerJunction>();
            }
            //null poiter exception fix

            if (IsOnServers.Exists(
                    junction => junction.Server.Id == server.Id)
                )
            {
                return;
            }
            //this connection already exists

            var junction = new UserServerJunction()
            {
                User   = this,
                Server = server
            };

            //create new junction

            IsOnServers.Add(junction);
            server.AreOnServer.Add(junction);
        }