public async Task <IActionResult> SetGestita([FromBody] SetSchedaGestitaCommand command)
        {
            command.CodiceSede = Request.Headers["codiceSede"];
            command.IdUtente   = Request.Headers["IdUtente"];

            try
            {
                _setGestita.Handle(command);
                return(Ok());
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains(Costanti.UtenteNonAutorizzato))
                {
                    return(StatusCode(403, Costanti.UtenteNonAutorizzato));
                }
                return(BadRequest());
            }
        }
Ejemplo n.º 2
0
        public async Task SendNotification(SetSchedaGestitaCommand command)
        {
            var getConteggioSchedeQuery = new GetConteggioSchedeQuery
            {
                CodiciSede = new string[] { command.CodiceSede }
            };

            var getSchedeContatto = new GetSchedeContattoQuery
            {
                CodiceSede = command.CodiceSede
            };

            var schedaContattoUpdated = _getSchedeContattoHandler.Handle(getSchedeContatto).SchedeContatto.Find(x => x.CodiceScheda.Equals(command.CodiceScheda));

            var infoNue = _getConteggioSchedeHandler.Handle(getConteggioSchedeQuery).InfoNue;
            await _notificationHubContext.Clients.Group(command.CodiceSede).SendAsync("NotifyGetContatoriSchedeContatto", infoNue);

            await _notificationHubContext.Clients.Groups(command.CodiceSede).SendAsync("NotifyUpdateSchedaContatto", schedaContattoUpdated);
        }