コード例 #1
0
        public UpdateICDOPage(Icdo icdo)
        {
            InitializeComponent();
            var updateIcdoViewModel = new UpdateICDOViewModel();

            updateIcdoViewModel.Icdo = icdo;
            BindingContext           = updateIcdoViewModel;
        }
コード例 #2
0
        public async void EditICDO()
        {
            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(Icdo.code) || string.IsNullOrEmpty(Icdo.description))
            {
                Value = true;
                return;
            }
            var icdo = new Icdo
            {
                id          = Icdo.id,
                code        = Icdo.code,
                description = Icdo.description
            };
            var cookie = Settings.Cookie;  //.Split(11, 33)
            var res    = cookie.Substring(11, 32);

            var response = await apiService.Put <Icdo>(
                "https://portalesp.smart-path.it",
                "/Portalesp",
                "/icdo/update",
                res,
                icdo);

            Debug.WriteLine("********responseIn ViewModel*************");
            Debug.WriteLine(response);
            if (!response.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok");

                return;
            }
            Value = false;
            ICDOViewModel.GetInstance().Update(icdo);

            DependencyService.Get <INotification>().CreateNotification("PortalSP", "ICDO Updated");
            await App.Current.MainPage.Navigation.PopPopupAsync(true);
        }