Example #1
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            await _conferenceRepository.DeleteAsync(id);

            await _sharedRepository.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
        public async Task DeleteAsync(Guid id)
        {
            // Can we delete a conference with tickets being already sold?
            var conference = await GetConferenceAsync(id);

            await _conferenceRepository.DeleteAsync(conference);

            _logger.LogInformation("Deleted a conference: '{Name}' with ID: '{Id}'", conference.Name, conference.Id);
        }
Example #3
0
        public async Task DeleteAsync(Guid id)
        {
            var conference = await _conferenceRepository.GetAsync(id);

            if (conference is null)
            {
                throw new ConferenceNotFoundException(id);
            }

            if (await _conferenceDeletionPolicy.CanDeleteAsync(conference) is false)
            {
                throw new CannotDeleteHConferenceException(id);
            }

            await _conferenceRepository.DeleteAsync(conference);
        }