private async void Button_OnClicked(object sender, EventArgs e) { var btn = (Button)sender; if (btn.Text.Contains("Post")) { RestfullServices.Departement d = new RestfullServices.Departement { Name = DepartementName.Text }; RestClient <RestfullServices.Departement> restClient = new RestClient <RestfullServices.Departement>(); await Navigation.PopAsync(); await restClient.PostAsync(d); } else { departement.Name = DepartementName.Text; // d.DepartementId = departement.DepartementId; RestClient <RestfullServices.Departement> restClient = new RestClient <RestfullServices.Departement>(); await restClient.PutAsync(departement.DepartementId, departement); await Navigation.PopAsync(); } }
public PostDepartement(RestfullServices.Departement d) { InitializeComponent(); departement = d; DeleteBtn.IsEnabled = true; DepartementName.Text = d.Name; PostBtn.Text = "Put Department"; }