public void setStatusRead(Trinity.DAL.DBContext.Notification notification, bool isReaded) { if (notification != null) { notification.IsRead = isReaded; } }
public void ChangeReadStatus(string notificationId) { Trinity.DAL.DBContext.Notification noti = _localUnitOfWork.DataContext.Notifications.FirstOrDefault(d => d.NotificationID == notificationId && (!d.IsRead.HasValue || !d.IsRead.Value)); if (noti != null) { noti.IsRead = true; _localUnitOfWork.GetRepository <DBContext.Notification>().Update(noti); _localUnitOfWork.Save(); } //var localRepo = _localUnitOfWork.GetRepository<DBContext.Notification>(); //var centralRepo = _centralizedUnitOfWork.GetRepository<DBContext.Notification>(); //var dbLocalNotification = GetNotification(Guid.Parse(notificationId), true); //if (dbLocalNotification != null) //{ // dbLocalNotification.IsRead = true; // localRepo.Update(dbLocalNotification); // _localUnitOfWork.Save(); //} //var dbCentralNotification = GetNotification(Guid.Parse(notificationId), false); //if (dbCentralNotification != null) //{ // dbCentralNotification.IsRead = true; // centralRepo.Update(dbCentralNotification); // _centralizedUnitOfWork.Save(); //} }
public Notification updateReadStatusLocal(string NotificationID, bool isReaded) { var localNotificationRepo = _localUnitOfWork.GetRepository <Trinity.DAL.DBContext.Notification>(); Trinity.DAL.DBContext.Notification notificationContext = localNotificationRepo.GetById(NotificationID); setStatusRead(notificationContext, isReaded); localNotificationRepo.Update(notificationContext); _localUnitOfWork.Save(); return(notificationContext.Map <Notification>()); }