Пример #1
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            var notification = await _repository.GetById(id);

            if (notification == null)
            {
                return(NotFound());
            }

            if (!await CheckIfUserAuthorizedForNotification(notification, NotificatinOperations.Delete))
            {
                return(Forbid());
            }

            await _repository.Delete(id);

            await _repository.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }