예제 #1
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);
        }
예제 #2
0
        public async Task SendNotification(MergeSchedeNueCommand command)
        {
            var getConteggioSchedeQuery = new GetConteggioSchedeQuery
            {
                CodiciSede = new string[] { command.CodiceSede }
            };

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

            await _notificationHubContext.Clients.Group(command.CodiceSede).SendAsync("NotifyUpdateSchedaContatto", command.SchedaNue);

            var codiciSchedecollegate = new string[command.SchedaNue.Collegate.Count];
            int i = 0;

            foreach (var schedaCollegata in command.SchedaNue.Collegate)
            {
                codiciSchedecollegate[i] = schedaCollegata.CodiceScheda;
                i++;
            }

            await _notificationHubContext.Clients.Group(command.CodiceSede).SendAsync("NotifyRemoveSchedeContatto", codiciSchedecollegate);
        }