public async Task Handle(AddAlertConnectionPersonGroupCommand notification) { var alert = await _alertRepository.GetByIdAsync(notification.IdAlerts); if (alert == null) { NotifyErrorValidations("AddAlertConnectionPersonGroupCommand", "Alert not found"); return; } var personGroup = await _personRepository.GetPersonGroupByIdAsync(notification.IdPersonGroups); if (personGroup == null) { NotifyErrorValidations("AddAlertConnectionPersonGroupCommand", "PersonGroup not found"); return; } await _alertRepository.AddConnectionPersonGroupAsync(notification.IdPersonGroups, notification.IdAlerts); if (Commit()) { await _mediator.PublishEvent(new AlertConnectionPersonGroupAddedEvent(_logger, notification.IdPersonGroups, notification.IdAlerts)); } }
//[Authorize(Policy = "Trade.GetById")] public async Task <AlertViewModel> GetAlertByIdAsync(int id) { var alert = await _alertRepository.GetByIdAsync(id); return(Mapper.Map <Alert, AlertViewModel>(alert)); }