Изменение логики прочтения уведомления

This commit is contained in:
parent f6ac5b5a98
commit e0320e7c99

View File

@ -92,13 +92,10 @@ public class NotificationService
cancellationToken)
?? throw new ArgumentInvalidException("Уведомление не найдено", nameof(idNotification));
if (isRead)
{
if (notification.SentDate == null)
throw new ArgumentInvalidException("Уведомление не может быть прочитано", nameof(isRead));
notification.SentDate = DateTime.UtcNow;
}
if(isRead && !notification.SentDate.HasValue)
throw new ArgumentInvalidException("Уведомление не может быть прочитано", nameof(isRead));
notification.ReadDate = isRead ? DateTime.UtcNow : null;
await notificationRepository.UpdateAsync(notification,
cancellationToken);