Example #1
0
 public async Task <bool> ExaminePostAsync(Post post, PostAuthStatus status)
 {
     try
     {
         return(await _postHttpService.ExaminePostAsync(post, status));
     }
     catch (Exception ex)
     {
         _logger.LogError("ExaminePostAsync failed, {@Exception}", ex);
         return(false);
     }
 }
Example #2
0
        public async Task <bool> ExaminePostAsync(Post post, PostAuthStatus status)
        {
            var command = new { PostId = post.Id, PostAuthStatus = status };
            HttpRequestMessage request = new HttpRequestMessage
            {
                Content    = new StringContent(JsonConvert.SerializeObject(command), Encoding.UTF8, "application/json"),
                Method     = HttpMethod.Put,
                RequestUri = new Uri(_client.BaseAddress, $"/api/posts/examine")
            };

            var response = await _client.SendAsync(request);

            response.EnsureSuccessStatusCode();

            return(JsonConvert.DeserializeObject <ResponseWrapper <bool> >(await response.Content.ReadAsStringAsync()).Data);
        }
Example #3
0
 // 审核帖子
 public void Examine(PostAuthStatus status)
 {
     PostAuthStatus = status;
 }