示例#1
0
        public async Task Handle(AddAlertCommand notification)
        {
            var entityCurrent = Mapper.Map <AlertModel, Alert>(notification.AlertModel);

            if (!IsEntityValid(entityCurrent))
            {
                return;
            }

            await _alertRepository.AddAsync(entityCurrent);

            if (Commit())
            {
                await _mediator.PublishEvent(new AlertAddedEvent(_logger, Mapper.Map <AlertModel>(notification.AlertModel)));
            }
        }