Example #1
0
        public async Task <ActionResult <ThreadMessage> > UpdateThread(ThreadMessage message)
        {
            (var thread, _) = await this.ExecuteAsync(() => _service.ReadThread(message.ThreadId));

            if (thread is null)
            {
                return(BadRequest($"Thread {message.ThreadId} is deleted"));
            }

            return(await this.ExecuteAsync(async() =>
            {
                await _service.UpdateThread(thread, message.MessageContext);

                return await _service.ReadThreadMessage(message.ThreadId);
            }).AsResultAsync());
        }