public UpdateRagServicePage(RagService ragService) { InitializeComponent(); var viewModel = new UpdateRagServiceViewModel(); viewModel.RagService = ragService; BindingContext = viewModel; }
public async void EditRagService() { 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(RagService.code) || string.IsNullOrEmpty(RagService.description) || RagService.report == null) { Value = true; return; } var request = new RagService { id = RagService.id, code = RagService.code, description = RagService.description, report = RagService.report }; var cookie = Settings.Cookie; //.Split(11, 33) var res = cookie.Substring(11, 32); var response = await apiService.Put <RagService>( "https://portalesp.smart-path.it", "/Portalesp", "/ragService/update", res, request); Debug.WriteLine("********responseIn ViewModel*************"); Debug.WriteLine(response); if (!response.IsSuccess) { await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok"); return; } Value = false; RequestModelViewModel.GetInstance().Update(request); DependencyService.Get <INotification>().CreateNotification("PortalSP", "Rag Service Updated"); await App.Current.MainPage.Navigation.PopPopupAsync(true); }
private async void Update_RequestModel(object sender, EventArgs e) { TappedEventArgs tappedEventArgs = (TappedEventArgs)e; RagService request = ((RequestModelViewModel)BindingContext).RequestModels.Where(ser => ser.id == (int)tappedEventArgs.Parameter).FirstOrDefault(); await PopupNavigation.Instance.PushAsync(new UpdateRagServicePage(request)); }