Exemple #1
0
 private async Task ApplyResponseRequest()
 {
     if (!long.TryParse(DatKey, out var key))
     {
         throw new BBSErrorException(BBSErrorType.BBSInvalidThreadKeyError);
     }
     var clientResponse = new ClientResponse()
     {
         Body = Body, Name = Name, Mail = Mail
     };
     await clientResponse.CreateResponseAsync(BoardKey, key,
                                              IpManager.GetHostName(_connectionInfo, _headers), _context, _dependency, _sessionManager.Session,
                                              true);
 }
        public async Task <IActionResult> CreateResponse([FromRoute] string boardKey, [FromRoute] int threadId, [FromBody] ClientResponse body)
        {
            try
            {
                var sess = new SessionManager(HttpContext, Context);

                var response =
                    await body.CreateResponseAsync(boardKey, threadId,
                                                   IpManager.GetHostName(HttpContext.Connection, HttpContext.Request.Headers),

                                                   Context, PluginDependency, sess.Session);

                await sess.UpdateSession();

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