コード例 #1
0
        public bool Put([FromBody] UpdatePostRequest request)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    return(_blogManager.EditPost(request));
                }
                catch (Exception ex)
                {
                    _logger.LogError(ex, $"Error editing post.", null);
                }
            }

            return(false);
        }
コード例 #2
0
 public Task <bool> UpdatePost(PostDTO post)
 {
     return(Task.FromResult(_blogManager.EditPost(new UpdatePostRequest {
         PostId = post.Id, Text = post.Text
     })));
 }