public void MarkAsRead(string userId, int notificationId) { var announ = _announcementUserRepository.GetSingleByCondition(x => x.AnnouncementId == notificationId && x.UserId == userId); if (announ == null) { _announcementUserRepository.Add(new AnnouncementUser() { AnnouncementId = notificationId, UserId = userId, HasRead = true }); } else { announ.HasRead = true; } }
public void MarkAsRead(string userId, int announcementId) { var announcement = _announcementUserRepository.Find(au => au.UserId == userId && au.AnnouncementId == announcementId, "AppUser"); if (announcement == null) { _announcementUserRepository.Add(new AnnouncementUser { AnnouncementId = announcementId, UserId = userId, HasRead = true }); } else { announcement.HasRead = true; } }