Пример #1
0
        private async void ExecuteSaveCommand(object obj)
        {
            var loader = await MaterialDialog.Instance.LoadingDialogAsync("Contact du serveur ... ", Configurations.MaterialConfig.MaterialLoadingDialogConfiguration);

            DemandeurIdentite.Id          = LiteDbHelper.CurrentUser.Id;
            DemandeurIdentite.Email       = LiteDbHelper.CurrentUser.Email;
            DemandeurIdentite.Password    = LiteDbHelper.CurrentUser.Password;
            DemandeurIdentite.Telephone   = Code.DialCode + DemandeurIdentite.Telephone;
            DemandeurIdentite.Nationalite = Pays.CountryName;
            //DemandeurIdentite.Naissance = LiteDbHelper.CurrentUser.Naissance;
            var data = DemandeurIdentite;

            try
            {
                await RestService.For <IBackendService>(Configurations.ServerConfig.Host).Update(JsonConvert.SerializeObject(DemandeurIdentite));

                LiteDbHelper.UpdateDataUser(DemandeurIdentite);
                await loader.DismissAsync();

                await Navigation.PushAsync(new HomePage());
            }
            catch (Exception e)
            {
                await loader.DismissAsync();

                if (e is Refit.ApiException)
                {
                    await MaterialDialog.Instance.SnackbarAsync($"{((Refit.ApiException)e).Content}", 3000, Configurations.MaterialConfig.MaterialSnackbarConfigurationError);
                }
                else
                {
                    await MaterialDialog.Instance.SnackbarAsync($"Erreur: {e.Message}", 3000, Configurations.MaterialConfig.MaterialSnackbarConfigurationError);
                }
            }
        }