private async void LoadPromociones() { var connection = await this.apiService.CheckConnection(); if (!connection.IsSuccess) { await Mensajes.Alerta("Verificá tu conexión a Internet"); return; } var content = new FormUrlEncodedContent(new[] { new KeyValuePair<string, string>("", ""), }); var response = await this.apiService.Get<PromocionesReturn>("/promociones", "/indexApp", content); if (!response.IsSuccess) { await Mensajes.Alerta("Ha habido un error en tu solicitud, por favor volvé a intentarlo"); return; } this.listPromociones = (PromocionesReturn)response.Result; PromocionesDetalle = new ObservableCollection<PromocionesItemViewModel>(this.ToPromocionesItemViewModel()); }
private async void LoadPromociones() { try { var connection = await this.apiService.CheckConnection(); if (!connection.IsSuccess) { await Mensajes.Alerta(connection.Message); return; } var content = new FormUrlEncodedContent(new[] { new KeyValuePair <string, string>("pro_tipo", "hopa"), }); var response = await this.apiService.Get <PromocionesReturn>("/promociones", "/indexTipoApp", content); if (!response.IsSuccess) { // await Mensajes.Alerta("Error al cargar Promociones"); return; } this.listPromociones = (PromocionesReturn)response.Result; #if __IOS__ PromocionesDetalle = new ObservableCollection <PromocionesItemViewModel>(this.ToPromocionesItemViewModel()); PromocionesDetalle2 = new ObservableCollection <PromocionesItemViewModel>(this.ToPromocionesItemViewModel()); #endif #if __ANDROID__ PromocionesDetalle = new ObservableCollection <PromocionesItemViewModel>(this.ToPromocionesItemViewModel2()); PromocionesDetalle2 = new ObservableCollection <PromocionesItemViewModel>(this.ToPromocionesItemViewModel2()); #endif if (PromocionesDetalle.Count > 0) { MuestraFlechasPromo = true; VariablesGlobales.RegistrosHotelPromociones = promocionesDetalle.Count - 1; VariablesGlobales.RegistrosHotelPromociones2 = promocionesDetalle.Count - 1; } else { MuestraFlechasPromo = false; } } catch (Exception) { MuestraFlechasPromo = false; // await Mensajes.Al("Hotel - Promociones" + ex.ToString()); } }
private async void LoadPromociones() { try { var connection = await this.apiService.CheckConnection(); if (!connection.IsSuccess) { await Mensajes.Alerta("Verificá tu conexión a Internet"); return; } var content = new FormUrlEncodedContent(new[] { new KeyValuePair <string, string>("pro_tipo", "cas"), }); var response = await this.apiService.Get <PromocionesReturn>("/promociones", "/indexTipoApp", content); if (!response.IsSuccess) { //await Mensajes.Error("Error al cargar Promociones"); return; } this.listPromociones = (PromocionesReturn)response.Result; //var test = MainViewModel.GetInstance().listPromociones; #if __ANDROID__ PromocionesDetalle = new ObservableCollection <PromocionesItemViewModel>(this.ToPromocionesItemViewModel2()); #endif #if __IOS__ PromocionesDetalle = new ObservableCollection <PromocionesItemViewModel>(this.ToPromocionesItemViewModel()); #endif if (PromocionesDetalle.Count > 0) { MuestraFlechasPromo = true; VariablesGlobales.RegistrosCasinoPromociones = PromocionesDetalle.Count - 1; } else { MuestraFlechasPromo = false; } } catch (Exception) { MuestraFlechasPromo = false; } }