예제 #1
0
        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());
        }
예제 #2
0
 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);
         }
     }
                ));
 }