Exemplo n.º 1
0
        public async void Insert_Data()
        {
            try
            {
                selectMiscellaneous.CUSTOMER_CODE = App.Current.Properties["Customer_Code"].ToString();
                HttpClient client = new HttpClient();
                client.DefaultRequestHeaders.Accept.Add(
                    new MediaTypeWithQualityHeaderValue("application/json"));
                client.BaseAddress = new Uri(GlobalData.gblApiAdress);
                var response = await client.PostAsJsonAsync("api/MiscellaneousAPI/CreateMiscellaneous/", selectMiscellaneous);

                if (response.StatusCode.ToString() == "OK")
                {
                    MessageBox.Show("Miscellaneous Data Added Successfully");
                    foreach (System.Windows.Window window in System.Windows.Application.Current.Windows)
                    {
                        if (window.DataContext == this)
                        {
                            window.Close();
                        }
                    }


                    DeliveryAddress _DA = new DeliveryAddress();
                    _DA.ShowDialog();
                }
            }
            catch
            {
            }
        }