示例#1
0
        public void Process(DefaultAutomaticReplyKeyMessageDefined @event)
        {
            var message = _defaultKeyMessages.GetById(@event.Id);

            if (message == null)
            {
                message = new DefaultAutomaticReplyKeyMessage(@event.Id)
                {
                    Type         = (AutomaticReplyKeyMessageType)@event.Type,
                    Language     = @event.Language,
                    Message      = @event.Message,
                    HealthRiskId = @event.HealthRiskId
                };

                _defaultKeyMessages.Insert(message);
            }
            else
            {
                message.Type         = (AutomaticReplyKeyMessageType)@event.Type;
                message.Language     = @event.Language;
                message.Message      = @event.Message;
                message.HealthRiskId = @event.HealthRiskId;

                _defaultKeyMessages.Update(message);
            }
        }
示例#2
0
        public void Save(DefaultAutomaticReplyKeyMessage keyMessage)
        {
            var filter = Builders <DefaultAutomaticReplyKeyMessage> .Filter.Where(v => v.Type == keyMessage.Type && v.Language == keyMessage.Language && v.HealthRiskId == keyMessage.HealthRiskId);

            _collection.ReplaceOne(filter, keyMessage, new UpdateOptions {
                IsUpsert = true
            });
        }