示例#1
0
        public async Task <CommentModel> AddCommentAsync(CommentModel model)
        {
            model = model ?? throw new ArgumentNullException(nameof(model));

            try
            {
                Comment entity = await this.repo.AddArticleCommentAsync(model.ToEntity()).ConfigureAwait(false);

                if (entity == null)
                {
                    return(null);
                }

                CommentModel updatedModel = new CommentModel();
                updatedModel.ToModel(entity);

                return(updatedModel);
            }
            catch
            {
                throw;
            }
        }