Beispiel #1
0
        private bool CopyMessageToRealtimeDB(string business_id, Message msg)
        {
            if (msg != null)
            {
                MessageModel message = new MessageModel(msg);


                //_fbMessageRepository.Upsert(business_id, message);
                //_sqlMessageRepository.Upsert(business_id, message);
                // _mongoMessageRepository.Upsert(business_id, message);
                _fbMessageRepository.AddGroupedByThread(business_id, message, message.thread_id);
            }
            return(true);
        }
        public bool CreateMessage(string business_id, MessageModel message)
        {
            //_messageRepository.Add(message);
            _messageRepository.Upsert(business_id, message);
            _messageRepository.AddGroupedByThread(business_id, message, message.thread_id);

            //if (message.sender_id != message.channel_id && message.sender_id != message.agent_id)
            //{
            //    var counter = new Counter { id = message.sender_id, count = 1 };
            //    _counterRepository.AddChannels(message.channel_id, counter);
            //    _counterRepository.AddChannelsUnread(message.channel_id, counter);

            //    if (string.IsNullOrWhiteSpace(message.agent_id))
            //    {
            //        _counterRepository.AddChannelsUnassignedUnread(message.channel_id, counter);
            //    }
            //    else
            //    {
            //        _counterRepository.AddAgents(message.agent_id, counter);
            //        _counterRepository.AddAgentsUnread(message.agent_id, counter);
            //    }
            //}
            return(true);
        }