Exemplo n.º 1
0
 public bool Add(int id, int userId)
 {
     var model = new MusicLike
     {
         DataId = id,
         CreateTime = DateTime.Now,
         IsDel = false,
         UserId = userId
     };
     return _musicLike.Insert(model) > 0;
 }
Exemplo n.º 2
0
 public bool Like(int id, int userId)
 {
     if (userId == 0 || _musicLike.Exist(t => t.DataId == id && t.UserId == userId && t.IsComment))
         return false;
     var model = new MusicLike
     {
         DataId = id,
         IsComment = true,
         CreateTime = DateTime.Now,
         IsDel = false,
         UserId = userId
     };
     var result = _musicLike.Insert(model) > 0;
     if (result)
         return _musicCommentRepository.UpdateLikeCount(id);
     return false;
 }