コード例 #1
0
        /// <inheritdoc />
        public async Task UpdateAsync(ChangeChatInfoCommand command, CancellationToken cancellationToken)
        {
            ChatData chat = _chatData.FirstOrDefault(ch => ch.Id == command.ChatId);

            if (chat == null)
            {
                return;
            }

            chat.Name = command.Name;
        }
コード例 #2
0
        public async Task <IActionResult> Put([FromBody] ChangeChatInfoCommand command, CancellationToken cancellationToken)
        {
            ChatDetails chat = await _chatsData.GetByIdAsync(command.ChatId, cancellationToken);

            if (chat == null)
            {
                return(this.NotFound(new ProblemDetails()
                {
                    Detail = $"Chat with id {command.ChatId} not found."
                }));
            }

            await _chatsData.UpdateAsync(command, cancellationToken);

            return(this.Ok());
        }