public IActionResult TopTopic([FromRoute] string Id) { var topic = _bZTopicRepository.Find(Id); if (topic != null) { topic.Top = topic.Top == 1 ? 0 : 1; topic.LastModifyDate = DateTime.Now; topic.LastModifierId = Guid.Empty.ToString(); _bZTopicRepository.Update(topic); _cacheService.Remove(nameof(BZTopicModel)); } return(Ok()); }
private bool DeleteOrActiveTopic(string Id, int status) { return(_unitOfWork.CommitWithTransaction (() => { var topic = _bZTopicRepository.Find(Id); if (topic != null) { topic.Status = status; var follows = _cacheService.GetFollowsAsync(p => p.TopicId == Id).Result.ToList(); follows.ForEach(p => p.Status = status); _bZFollowRepository.Update(follows); _bZTopicRepository.Update(topic); var replys = _cacheService.GetReplysAsync(p => p.TopicId == Id).Result.ToList(); replys.ForEach(p => p.Status = status); _bZReplyRepository.Update(replys); } } )); }