Пример #1
0
            private async Task ApplyThreadRequest()
            {
                var clientThread = new ClientThread()
                {
                    Title    = Title,
                    Response = new ClientResponse()
                    {
                        Body = Body, Mail = Mail, Name = Name
                    }
                };
                var ip = IpManager.GetHostName(_connectionInfo, _headers);

                await clientThread.CreateThreadAsync(BoardKey, ip, _context, _dependency, _sessionManager.Session);
            }
Пример #2
0
        public async Task <IActionResult> CreateThread([FromRoute] string boardKey, [FromBody] ClientThread thread)
        {
            try
            {
                var sess = new SessionManager(HttpContext, Context);

                var ip     = IpManager.GetHostName(HttpContext.Connection, HttpContext.Request.Headers);
                var result = await thread.CreateThreadAsync(boardKey, ip, Context, PluginDependency, sess.Session);

                await sess.UpdateSession();

                return(CreatedAtAction(nameof(GetThread), new { id = result.ThreadId }, result));
            }
            catch (BBSErrorException e)
            {
                var error = e.BBSError;
                return(StatusCode(error.ResponseCode, error));
            }
        }