public async Task <IActionResult> DeleteConfirmed(DeleteExerciseTemplateViewModel deleteExerciseTemplatesViewModel)
        {
            var deletedExercice = await _exercisesRepository.DeleteAsync(deleteExerciseTemplatesViewModel.Id);

            if (!deletedExercice)
            {
                return(NotFound());
            }
            return(RedirectToAction(nameof(Edit), "TestTemplates", new { Id = deleteExerciseTemplatesViewModel.TestTemplateId }));
        }
Ejemplo n.º 2
0
        private async Task OnDelete()
        {
            try
            {
                var answer = await _dialogService.DisplayAlert(AppResources.ExerciseDeleteQuestionTitle, AppResources.ExerciseDeleteQuestion, AppResources.Yes, AppResources.No);

                if (answer)
                {
                    await _exercisesRepository.DeleteAsync(ExerciseId);

                    _messagingService.Send(this, Messages.ItemDeleted);

                    await _navigationService.PopAsync();
                }
            }
            catch (Exception ex)
            {
                App.ShowErrorPage(this, ex);
            }
        }