public async Task <IResultModel> Add(TopicAddModel model)
        {
            var entity = _mapper.Map <TopicEntity>(model);

            //if (await _repository.Exists(entity))
            //{
            //return ResultModel.HasExists;
            //}
            using var uow = _forumDbContext.NewUnitOfWork();
            var result = await _repository.AddAsync(entity, uow);

            if (result && model.Tags != null && model.Tags.Count() > 0)
            {
                var tagList = model.Tags.Select(s => new TopicTagEntity
                {
                    TopicId = entity.Id,
                    TagId   = s
                }).ToList();

                //新增只需要重新添加即可 消息队列处理
                await _topicTagRepository.AddAsync(tagList, uow);

                uow.Commit();

                await _tagRepository.AddCount(model.Tags);

                await _categoryRepository.AddCount(new int[] { entity.CategoryId });
            }
            return(ResultModel.Result(result));
        }
        public async Task <IResultModel> UpdateSortList(SortUpdateModel <long> model)
        {
            if (model.Options == null || !model.Options.Any())
            {
                return(ResultModel.Failed("²»°üº¬Êý¾Ý"));
            }

            using (var uow = _dbContext.NewUnitOfWork())
            {
                foreach (var option in model.Options)
                {
                    var entity = await _repository.GetAsync(option.Id, uow);

                    if (entity == null)
                    {
                        return(ResultModel.Failed());
                    }
                    entity.Sort = option.Sort;
                    if (!await _repository.UpdateAsync(entity, uow))
                    {
                        return(ResultModel.Failed());
                    }
                }
                uow.Commit();
            }

            return(ResultModel.Success());
        }