Exemple #1
0
        public async Task <IActionResult> SaveContentCommentAsync([FromBody] ContentCommentEntity entity)
        {
            if (entity == null)
            {
                return(ChangeErrorKinds.Argument.ToActionResult("Requires an entity in body."));
            }
            var instance = await this.GetResourceAccessClientAsync();

            var result = await instance.SaveAsync(entity);

            Logger?.LogInformation(new EventId(17001217, "PostContentComment"), "Post a comment to a publish content.");
            return(result.ToActionResult());
        }
Exemple #2
0
 /// <summary>
 /// Creates or updates a publish content comment entity.
 /// </summary>
 /// <param name="comment">The publish content comment entity to save.</param>
 /// <param name="cancellationToken">The optional token to monitor for cancellation requests.</param>
 /// <returns>The change method.</returns>
 public Task <ChangeMethods> SaveAsync(ContentCommentEntity comment, CancellationToken cancellationToken = default)
 {
     return(SaveAsync(contentComments, comment, cancellationToken));
 }
        /// <summary>
        /// Creates or updates a publish content comment entity.
        /// </summary>
        /// <param name="comment">The publish content comment entity to save.</param>
        /// <param name="cancellationToken">The optional token to monitor for cancellation requests.</param>
        /// <returns>The change method.</returns>
        public Task <ChangeMethods> SaveAsync(ContentCommentEntity comment, CancellationToken cancellationToken = default)
        {
            var context = GetContext();

            return(DbResourceEntityExtensions.SaveAsync(context.ContentComments, context.SaveChangesAsync, comment, cancellationToken));
        }