public UpdateRegionPage(Reggion region) { InitializeComponent(); var viewModel = new UpdateRegionViewModel(); viewModel.Region = region; BindingContext = viewModel; }
public async void EditRegion() { 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(Region.code) || string.IsNullOrEmpty(Region.description)) { Value = true; return; } var region = new Reggion { id = Region.id, code = Region.code, description = Region.description }; var response = await apiService.Put <Reggion>( "https://app.smart-path.it", "/md-core", "/medial/region", region); if (!response.IsSuccess) { await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok"); return; } Value = false; RegionViewModel.GetInstance().Update(region); DependencyService.Get <INotification>().CreateNotification("Medial", "Region Updated"); await App.Current.MainPage.Navigation.PopPopupAsync(true); }