示例#1
0
        //public ICommand DeleteCustomerCommand
        //{
        //    get { return new RelayCommand(DeleteCustomer); }
        //}

        private async void SaveCustomer()
        {
            if (SelectedCustomer == null || !SelectedCustomer.IsValid())
            {
                Error = "Klant niet gewijzigd, hou rekening met de meldingen.";
                return;
            }
            else
            {
                Error = "";
            }

            string input = JsonConvert.SerializeObject(SelectedCustomer);

            using (HttpClient client = new HttpClient())
            {
                client.SetBearerToken(ApplicationVM.token.AccessToken);
                HttpResponseMessage response = await client.PutAsync("http://localhost:55853/api/customer", new StringContent(input, Encoding.UTF8, "application/json"));

                if (!response.IsSuccessStatusCode)
                {
                    Console.WriteLine("error");
                }
            }
        }
示例#2
0
 private bool CanExecuteAddClient()
 {
     if (SelectedCustomer == null)
     {
         return(false);
     }
     else
     {
         return(SelectedCustomer.IsValid());
     }
 }