| | |
| | | public async Task<int> Handle(SetTaskInfoRecommendStatusCommand request, CancellationToken cancellationToken) |
| | | { |
| | | var entities = await TaskInfoRepository.GetQueryable(rep, false) |
| | | .Where(it => request.Ids.Contains(it.Id)) |
| | | .Where(it => request.Ids.Contains(it.Id) && it.RecommendStatus != request.RecommendStatus) |
| | | .ToListAsync(); |
| | | if (entities.IsNotNull()) |
| | | { |
| | | foreach (var entity in entities) |
| | | { |
| | | entity.RecommendStatus = request.RecommendStatus; |
| | | if (entity.RecommendStatus == EnumTaskRecommendStatus.Yes) |
| | | { |
| | | entity.RecommendTime = DateTime.Now; |
| | | } |
| | | } |
| | | await rep.UpdateAsync(entities); |
| | | } |
| | | return entities.Count; |
| | | } |
| | | |