Example #1
0
        public ChatModel NewUser(User user)
        {
            ChatModel model = new ChatModel();

            if (_chatRepo.ActiveUserCount() >= MAX_USERS)
            {
                model.TooManyUsers = true;
                model.Messages     = new List <Message>();
                model.Users        = new List <User>();

                return(model);
            }

            _chatRepo.AddUser(ObjectTranslator.GetDbUser(user));

            model.Messages = GetLatestMessages().ToList();
            model.Users    = GetActiveUsers().ToList();

            return(model);
        }