public UpdateCustomDutyPage(CustomsDuty customsDuty) { InitializeComponent(); var ViewModel = new UpdateCustomDutyViewModel(); ViewModel.CustomsDuty = customsDuty; BindingContext = ViewModel; }
public async void EditCustomsDuty() { Value = true; var connection = await apiService.CheckConnection(); if (!connection.IsSuccess) { await Application.Current.MainPage.DisplayAlert( Languages.Warning, Languages.CheckConnection, Languages.Ok); return; } if (string.IsNullOrEmpty(CustomsDuty.code) || string.IsNullOrEmpty(CustomsDuty.description) || string.IsNullOrEmpty(CustomsDuty.taxRate)) { Value = true; return; } var customsDuty = new CustomsDuty { id = CustomsDuty.id, code = CustomsDuty.code, description = CustomsDuty.description, taxRate = CustomsDuty.taxRate }; var response = await apiService.Put <CustomsDuty>( "https://app.smart-path.it", "/md-core", "/medial/config", customsDuty); if (!response.IsSuccess) { await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok"); return; } Value = false; CustomDutyViewModel.GetInstance().Update(customsDuty); DependencyService.Get <INotification>().CreateNotification("Medial", "Custom Duty Updated"); await App.Current.MainPage.Navigation.PopPopupAsync(true); }