예제 #1
0
        public async Task MarkNotificationAsRead(Guid notificationId)
        {
            var notification = await _notificationsContext.Notifications.FindAsync(notificationId);

            _notificationsContext.Remove(notification);
            await _notificationsContext.SaveChangesAsync();
        }
예제 #2
0
        public virtual async Task DeleteNotificationProfile(Guid?id)
        {
            if (!id.HasValue || id == Guid.Empty)
            {
                throw new IdNullOrEmptyException();
            }

            var entity = await _notificationsContext.NotificationProfiles.FindAsync(id);

            if (entity == null)
            {
                throw new NotFoundException(typeof(NotificationProfile).Name, $"{id}");
            }

            _notificationsContext.Remove(entity);
            await _notificationsContext.SaveChangesAsync();
        }