private void button_Click(object sender, RoutedEventArgs e)
        {
            if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox.Text == "")
            {
                MessageBox.Show("There are some missing content");
            }
            else
            {
                HttpClient client = new HttpClient();
                client.BaseAddress = new Uri("http://localhost:62135/");

                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                var Article = new NewArticle();

                try
                {
                    Article.AName        = textBox.Text;
                    Article.ARtName      = textBox1.Text;
                    Article.Article_ID   = Convert.ToInt16(textBox2.Text);
                    Article.Subj_Article = textBox3.Text;
                    Article.Article_Date = Convert.ToDateTime(textBox4.Text);
                    Article.ID           = Convert.ToInt16(textBox6.Text);
                    Article.Type_user    = combobox.Text;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(Convert.ToString(ex));
                }
                try
                {
                    var response = client.PostAsJsonAsync("api/Article", Article).Result;
                    if (response.IsSuccessStatusCode)
                    {
                        MessageBox.Show("New Article has been added Succesfully");
                        clearTexts();
                    }
                    else
                    {
                        MessageBox.Show(response.StatusCode + "With Message " + response.ReasonPhrase);
                    }
                }
                catch {
                    MessageBox.Show("No connection to the server", "Connection Error");
                }
            }
        }
        private void button_Click(object sender, RoutedEventArgs e)
        {
            if (textBox.Text == "" || textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "" || textBox6.Text == "")
            {
                MessageBox.Show("There are some missing content");
            }
            else
            {
                HttpClient client = new HttpClient();
                client.BaseAddress = new Uri("http://localhost:62135/");

                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                var article = new NewArticle();

                article.AName        = textBox.Text;
                article.ARtName      = textBox1.Text;
                article.Subj_Article = textBox3.Text;
                article.Article_Date = Convert.ToDateTime(textBox4.Text);
                article.ID           = Convert.ToInt16(textBox5.Text);
                article.Type_user    = textBox6.Text;

                var id  = textBox2.Text;
                var url = "api/Article/" + id;

                var response = client.PutAsJsonAsync(url, article).Result;

                try
                {
                    if (response.IsSuccessStatusCode)
                    {
                        MessageBox.Show("Article with ID" + textBox4.Text + "has been updated successfully");
                        clearTexts();
                    }
                    else
                    {
                        MessageBox.Show("There is an Error");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(Convert.ToString(ex));
                }
            }
        }