public async Task <BaseResult> CreateOrUpdate(CommentModel model) { var comment = model.ToComment(); comment.UpdateCommonInt(); if (comment.ParentId != null && comment.ParentId != 0) { var validParent = CommentRepository.Query().Where(x => x.LectureId == comment.LectureId).FirstOrDefault(x => x.Id == comment.ParentId); if (validParent == null) { return(new CreateOrUpdateResult() { Result = Result.Failed, Message = "Không tìm thấy id bình luận cha trong danh sách bình luận của bài giảng" }); } } if (comment.Id > 0) { return(await Update(comment)); } else { return(await Create(comment)); } }