示例#1
0
        public bool Remove(Guid Id)
        {
            var rels = likeDal.GetALL().Where(x => x.ImageId == Id);

            foreach (var link in rels)
            {
                likeDal.Remove(link.UserId, link.ImageId);
            }
            return(imageDal.Remove(Id));
        }
示例#2
0
 public bool LiceImage(Guid userId, Guid imageId)
 {
     if (likeDal.GetALL().FirstOrDefault(x => x.UserId == userId && x.ImageId == imageId) == null)
     {
         return(likeDal.Add(new LikeImage {
             UserId = userId, ImageId = imageId
         }));
     }
     else
     {
         return(likeDal.Remove(userId, imageId));
     }
 }