public CodeConnection GetSessionById(string user, string id)
        {
            var element = this.GetCodeSessionById(id);

            if (element == null)
            {
                return(null);
            }

            if (!element.Participants.Contains(user))
            {
                element.Participants.Add(user);
            }

            var codeConnection = new CodeConnection()
            {
                CodeSession = element, User = user
            };

            return(codeConnection);
        }
Beispiel #2
0
        public CodeConnection GetSessionById(string user, string id)
        {
            var element = this.codeSessions.FirstOrDefault(cs => cs.Id == id);

            if (element == null)
            {
                return(null);
            }

            var codeConnection = new CodeConnection()
            {
                CodeSession = element, User = user
            };

            if (!codeConnection.CodeSession.Participants.Contains(user))
            {
                codeConnection.CodeSession.Participants.Add(user);
            }

            return(codeConnection);
        }