Exemplo n.º 1
0
        /// <summary>
        /// 删除文章评论
        /// </summary>
        public async Task <Result> DeleteArticalCommentAsync(long commentId)
        {
            Result result = new Result();

            do
            {
                var comment = await db.ArticalComments.FirstOrDefaultAsync(e => e.Id == commentId);

                if (comment == null)
                {
                    result.ErrorMessage = ErrorMessages.NotFound;
                    break;
                }

                db.Remove(comment);
                await db.SaveChangesAsync();

                result.Succeeded = true;
            } while (false);
            return(result);
        }