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