Ejemplo n.º 1
0
        public bool DeleteCalendar(int id, int userId)
        {
            if (GetCalendar(id).UserId != userId)
            {
                throw new ForbiddenException("Not calendar owner");
            }

            if (id == _caRepository.GetDefaultCalendar(userId).Id)
            {
                throw new ForbiddenException("Forbidden to remove the 'Default' calendar");
            }

            _notificationSender.CancelScheduledNotification(_eventRepository.GetCalendarEvents(id).ToArray());

            _logger.Info($"Delete calendar {id}");
            return(_caRepository.DeleteCalendar(id));
        }