JabbR.Services.ChatService.AddClient C# (CSharp) Method

AddClient() public method

public AddClient ( JabbR.Models.ChatUser user, string clientId, string userAgent ) : JabbR.Models.ChatClient
user JabbR.Models.ChatUser
clientId string
userAgent string
return JabbR.Models.ChatClient
        public ChatClient AddClient(ChatUser user, string clientId, string userAgent)
        {
            ChatClient client = _repository.GetClientById(clientId);
            if (client != null)
            {
                return client;
            }

            client = new ChatClient
            {
                Id = clientId,
                User = user,
                UserAgent = userAgent,
                LastActivity = DateTimeOffset.UtcNow
            };

            _repository.Add(client);
            _repository.CommitChanges();

            return client;
        }