Esempio n. 1
0
        private async Task <Unit> UpdateBroadcastInternalAsync(Guid broadcastId, string title, string content, CancellationToken cancellationToken)
        {
            try
            {
                var existingBroadcast = await broadcastStore.GetBroadcast(broadcastId, cancellationToken);

                if (existingBroadcast is null)
                {
                    throw new ArgumentException("O broadcast não existe", nameof(broadcastId));
                }

                existingBroadcast.Title   = title;
                existingBroadcast.Content = content;
                await broadcastStore.UpdateBroadcast(broadcastId, existingBroadcast, cancellationToken);

                await hubContext.Clients.All.ReceiveUpdatedBroadcast(existingBroadcast);

                return(Unit.Value);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 2
0
        private async Task <BroadcastMessage> GetBroadcastInternalAsync(Guid broadcastId, CancellationToken cancellationToken)
        {
            var existingBroadcast = await broadcastStore.GetBroadcast(broadcastId, cancellationToken);

            return(existingBroadcast);
        }