private async void SubmitButton_Clicked(object sender, EventArgs e) { try { VoteInputView inputVote = new VoteInputView { comments = entryComment.Text, supercarId = Convert.ToInt32(entrySuperCarId.Text), userId = _myProfile.UserId }; await _myServices.PostVote(inputVote); //var dataBaru = await _myServices.GetLeaderboardById(Convert.ToInt32(entrySuperCarId)); //this.BindingContext = dataBaru; await DisplayAlert("Keterangan", "Vote Berhasil Ditambah", "OK"); var data = await _myServices.GetLeaderboardById(Convert.ToInt32(entrySuperCarId.Text)); data.Votes.RemoveAll(item => item == null); this.BindingContext = data; BeginInit(); } catch (Exception ex) { await DisplayAlert("Kesalahan", $"{ex.Message}", "OK"); } }
private async void LvLeaderboard_ItemTapped(object sender, ItemTappedEventArgs e) { var car = e.Item as Leaderboard; try { var data = await _myServices.GetLeaderboardById(car.SupercarId); var detailPage = new DetailPage(); data.Votes.RemoveAll(item => item == null); detailPage.BindingContext = data; await Navigation.PushAsync(detailPage); } catch (Exception ex) { await DisplayAlert("Error", ex.Message, "OK"); } }