示例#1
0
        private void EditLearnable_Click(object sender, RoutedEventArgs e)
        {
            if (SelectedLearnable == null)
            {
                System.Windows.Forms.MessageBox.Show("Nincs kiválasztva a szó, amit szerkeszteni szeretnél!", "Szószerkesztés hiba");
                return;
            }

            LearnableEditor dialog = new LearnableEditor(CourseList, SelectedLearnable);

            if (dialog.ShowDialog().Value)
            {
                if (dialog.Word == null)
                {
                    return;
                }

                using (var client = HttpHelpers.InitializeHttpClient())
                {
                    HttpResponseMessage response = client.PutAsJsonAsync("api/learnable/" + dialog.Word.LearnableID, dialog.Word).Result;
                    if (HttpHelpers.IsSuccessfullRequest(response, "Váratlan hiba történt, a szó módosítása nem sikerült. Kérjük, próbálja később!"))
                    {
                        InitLearnablesList();
                    }
                }
            }
        }
示例#2
0
        private void NewLearnable_Click(object sender, RoutedEventArgs e)
        {
            LearnableEditor dialog = new LearnableEditor(CourseList, SelectedCourse);

            if (dialog.ShowDialog().Value)
            {
                if (dialog.Word == null)
                {
                    return;
                }

                using (var client = HttpHelpers.InitializeHttpClient())
                {
                    HttpResponseMessage response = client.PostAsJsonAsync("api/learnable", dialog.Word).Result;
                    if (HttpHelpers.IsSuccessfullRequest(response, "Váratlan hiba történt, a szó felvétele nem sikerült. Kérjük, próbálja később!"))
                    {
                        InitLearnablesList();
                    }
                }
            }
        }