Ejemplo n.º 1
0
        public async Task DeleteProfile(Profile profile)
        {
            MessageBoxDialogResult result = await ModalDialog.ShowMessageBoxAsync("Confirm Delete", "Are you sure you want to delete the profile ?", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button2);

            if (result == MessageBoxDialogResult.Yes)
            {
                await ProfileService.DeleteProfile(profile.Id);
                await RefreshListAsync();
            }
        }
Ejemplo n.º 2
0
        protected async Task CreateProfiles()
        {
            var result = await ProfileService.CreateFakeProfiles(SomeUsers);

            if (result != null)
            {
                SomeUsers = new List <FakeProfileModel>();
                await ModalDialog.ShowMessageBoxAsync("Profile profiles created successfully", $"Profiles created: {result.CptrSucceed} - Failed: {result.CptrFailed}", MessageBoxButtons.OK, MessageBoxDefaultButton.Button1);
            }
        }
Ejemplo n.º 3
0
        public async Task DeleteBook(Book book)
        {
            MessageBoxDialogResult result = await ModalDialog.ShowMessageBoxAsync("Confirm Delete", "Are you sure you want to delete the book ?", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button2);

            if (result == MessageBoxDialogResult.Yes)
            {
                await BookService.DeleteBook(book.Id);
                await RefreshListAsync();
            }
        }
Ejemplo n.º 4
0
        protected async Task DeleteEpisode(Chapter OneChapter, Episode OneEpisode)
        {
            MessageBoxDialogResult result = await ModalDialog.ShowMessageBoxAsync("Confirm Delete", "Are you sure you want to delete the episode ?", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button2);

            if (result == MessageBoxDialogResult.Yes)
            {
                await EpisodeService.DeleteEpisode(OneEpisode.Id);

                OneChapter.Episodes.Remove(OneEpisode);
                StateHasChanged();
            }
        }
Ejemplo n.º 5
0
        protected async Task DeleteChapter(Chapter OneChapter)
        {
            MessageBoxDialogResult result = await ModalDialog.ShowMessageBoxAsync("Confirm Delete", "Are you sure you want to delete the chapter ?", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button2);

            if (result == MessageBoxDialogResult.Yes)
            {
                await ChapterService.DeleteChapter(OneChapter.Id);

                OneQuiz.Chapters.Remove(OneChapter);
                StateHasChanged();
            }
        }
Ejemplo n.º 6
0
        protected async Task DeleteQuiz(QuizTopic OneQuiz)
        {
            var response = await ModalDialog.ShowMessageBoxAsync("Question", "Delete quiz ?", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button1);

            if (response == MessageBoxDialogResult.Yes)
            {
                await QuizService.DeleteQuiz(OneQuiz.Id);

                SomeQuizzes = await QuizService.GetQuizzes(pageNumber : SomeQuizzes.PageIndex, pageSize : PageSize, sortOrder : GetCurrentSortOrder, filters : GetCurrentFilters);

                StateHasChanged();
            }
        }
Ejemplo n.º 7
0
        protected async Task AddEpisode(Chapter OneChapter)
        {
            if (OneQuiz.Id == 0)
            {
                var response = await ModalDialog.ShowMessageBoxAsync("Question", "Do you want to save this new quiz ?", MessageBoxButtons.YesNo);

                if (response == MessageBoxDialogResult.No)
                {
                    return;
                }
                var result = await TrySavingChanges();

                if (result == false)
                {
                    return;
                }
            }

            ModalDialogParameters parameters = new ModalDialogParameters();

            parameters.Add("Title", "");
            parameters.Add("VideoId", "");
            parameters.Add("Duration", 0);
            parameters.Add("Trailer", "");

            var dialogResult = await ModalDialog.ShowDialogAsync <EpisodeEdit>("Add episode", new ModalDialogOptions(), parameters);

            if (dialogResult.Success)
            {
                var episode = new Episode
                {
                    Title     = dialogResult.ReturnParameters.Get <string>("Title"),
                    VideoId   = dialogResult.ReturnParameters.Get <string>("VideoId"),
                    Duration  = dialogResult.ReturnParameters.Get <int>("Duration"),
                    Trailer   = dialogResult.ReturnParameters.Get <string>("Trailer"),
                    ChapterId = OneChapter.Id
                };

                if (OneChapter.Episodes == null)
                {
                    OneChapter.Episodes = new List <Episode>();
                }

                OneChapter.Episodes.Add(episode);
                await EpisodeService.AddEpisode(episode);

                StateHasChanged();
            }
        }
Ejemplo n.º 8
0
        protected async Task DeleteQuiz()
        {
            MessageBoxDialogResult result = await ModalDialog.ShowMessageBoxAsync("Confirm Delete", "Are you sure you want to delete the quiz ?", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button2);

            if (result == MessageBoxDialogResult.Yes)
            {
                await QuizService.DeleteQuiz(OneQuiz.Id);

                StatusClass = "alert-danger";
                Message     = "Deleted successfully";
                StateHasChanged();
                await Task.Delay(1000);

                NavigationManager.NavigateTo("/admin/quizzes");
            }
        }
Ejemplo n.º 9
0
        protected async Task AddChapter()
        {
            if (OneQuiz.Id == 0)
            {
                var response = await ModalDialog.ShowMessageBoxAsync("Question", "Do you want to save this new quiz ?", MessageBoxButtons.YesNo);

                if (response == MessageBoxDialogResult.No)
                {
                    return;
                }
                var result = await TrySavingChanges();

                if (result == false)
                {
                    return;
                }
            }

            ModalDataInputForm frm = new ModalDataInputForm("Add chapter", "Please give a title");

            var titleFld = frm.AddStringField("title", "Title", "", "The title of the chapter");

            if (await frm.ShowAsync(ModalDialog))
            {
                var chapter = new Chapter {
                    Title = titleFld.Value, QuizTopicId = OneQuiz.Id
                };
                var addedChapter = await ChapterService.AddChapter(chapter);

                if (OneQuiz.Chapters == null)
                {
                    OneQuiz.Chapters = new List <Chapter>();
                }

                OneQuiz.Chapters.Add(addedChapter);
                StateHasChanged();
            }
        }
Ejemplo n.º 10
0
        protected async Task InjectQuizzes()
        {
            var result = await QuizService.CreateQuizzesFromJsonOfOpenQuizzDB();

            await ModalDialog.ShowMessageBoxAsync("Quizzes injection", $"Operation finished. Total quizzes created: {result}", MessageBoxButtons.OK);
        }