public async Task Notify(AddUtenteCommand command) { var utente = _getUtenteByCF.Get(command.CodFiscale); await _notificationHubContext.Clients.Group(command.CodiceSede).SendAsync("NotifyRefreshUtenti", true); await _notificationHubContext.Clients.Group(utente.Sede.Codice).SendAsync("NotifyRefreshUtenti", true); }
public IActionResult AddUtente([FromBody] AddUtenteCommand command) { command.CodiceSede = Request.Headers["codiceSede"]; try { _addUtenteCommand.Handle(command); return(Ok()); } catch (System.Exception ex) { if (ex.Message.Contains(Costanti.UtenteNonAutorizzato)) { return(StatusCode(403, Costanti.UtenteNonAutorizzato)); } return(BadRequest()); } }
public async Task Notify(AddUtenteCommand command) { var utente = _getUtenteByCF.Get(command.CodFiscale); await _notificationHubContext.Clients.All.SendAsync("NotifyAddUtente", utente.Ruoli[0].CodSede); }