Exemple #1
0
        public void RemoveApartmentCommentLike(long apartmentCommentId, long profileId)
        {
            ApartmentCommentLike like = context.ApartmentCommentLikes
                                        .Where(m => m.ApartmentCommentId == apartmentCommentId && m.ProfileId == profileId)
                                        .FirstOrDefault();

            if (like != null)
            {
                context.ApartmentCommentLikes.Remove(like);
                context.SaveChanges();
            }
        }
Exemple #2
0
        public void AddApartmentCommentLike(long apartmentCommentId, long profileId)
        {
            ApartmentCommentLike like = context.ApartmentCommentLikes
                                        .Where(m => m.ApartmentCommentId == apartmentCommentId && m.ProfileId == profileId)
                                        .FirstOrDefault();

            if (like == null)
            {
                context.ApartmentCommentLikes.Add(new ApartmentCommentLike
                {
                    ApartmentCommentId = apartmentCommentId,
                    ProfileId          = profileId,
                    Date = DateTime.Now
                });
                context.SaveChanges();
            }
        }