private async void ToolbarItem_Clicked(object sender, EventArgs e) { try { var selectedExclusive = exclusiveListView.SelectedItem as ExclusiveDTO; var category = selectedExclusive.GroupName; ExclusivePost exclusivePost = new ExclusivePost() { Experience = experienceEntry.Text, GroupName = category, gCord = $"{selectedExclusive.gCord}", Aggelia = selectedExclusive.Aggelia, Area = selectedExclusive.Area, IsFavorite = selectedExclusive.IsFavorite, priceUponRequest = selectedExclusive.priceUponRequest, PropertyCode = selectedExclusive.PropertyCode, ShownPrice = selectedExclusive.ShownPrice, TitleCAP = selectedExclusive.TitleCAP, Title = selectedExclusive.Title, Distance = selectedExclusive.Distance, UserId = App.user.Id }; if (CrossConnectivity.Current.IsConnected) { asyncIndicator.IsEnabled = true; await App.MobileService.GetTable <ExclusivePost>().InsertAsync(exclusivePost); asyncIndicator.IsEnabled = false; await DisplayAlert("Success", "Experience succesfully inserted", "OK"); } else { using (SQLiteConnection conn = new SQLiteConnection(App.DatabaseLocation)) { conn.CreateTable <ExclusivePost>(); int rows = conn.Insert(exclusivePost); if (rows > 0) { await DisplayAlert("Success", "Experience succesfully inserted", "OK"); } else { await DisplayAlert("Failure", "Experience failed to be inserted", "OK"); } } } } catch (NullReferenceException nre) { await DisplayAlert("Failure", "Experience failed to be inserted", "OK"); } catch (Exception ex) { await DisplayAlert("Failure", "Experience failed to be inserted", "OK"); } }
public PostDetailPage(ExclusivePost selectedPost) { InitializeComponent(); this.selectedExclusivePost = selectedPost; activityAsync.IsEnabled = true; iconImage.Source = ImageSource.FromUri(new Uri(String.Format(@"http://www.ploumis-sotiropoulos.gr/webads_old/{0}/us1.campaign-archive.com_files/m.jpg", selectedPost.PropertyCode))); activityAsync.IsEnabled = false; experienceEntry.Text = selectedPost.Experience; venueLabel.Text = selectedPost.Area; categoryLabel.Text = selectedPost.Title; addressLabel.Text = selectedPost.Aggelia; coordinatesLabel.Text = selectedPost.gCord; distanceLabel.Text = $"{selectedPost.Distance} m"; }