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)); }
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)); } }