//Creating JSON object to represent the ratings and reviews, to send to database table 'ratings' in backend public async void OnSend(object sender, EventArgs e) { // Borrower rates/reviews item and lending user if (borrowed) { if (userRating.Value == 0 || itemRating.Value == 0) { await DisplayAlert("Error", "Both ratings must be given", "Ok"); return; } else { String sid = await App.Authenticator.GetUserId(); Ratings usersRating = new Ratings { IsItem = false, Rating = userRating.Value, Review = userReview.Text, RatedID = otherUser.UserId, ReviewerID = sid }; await manager.SaveRatingsAsync(usersRating); Ratings itemsRating = new Ratings { IsItem = true, Rating = itemRating.Value, Review = itemReview.Text, RatedID = item.Id, ReviewerID = sid }; await manager.SaveRatingsAsync(itemsRating); await DisplayAlert("Success", "Your rating has been recorded!", "Ok"); await Navigation.PopModalAsync(); } } // Lender only rates/reviews borrowing user else { if (userRating.Value == 0) { await DisplayAlert("Error", "Rating must be given", "Ok"); return; } else { String sid = await App.Authenticator.GetUserId(); Ratings usersRating = new Ratings { IsItem = false, Rating = userRating.Value, Review = userReview.Text, RatedID = otherUser.UserId, ReviewerID = sid }; await manager.SaveRatingsAsync(usersRating); await DisplayAlert("Success", "Your rating has been recorded!", "Ok"); await Navigation.PopModalAsync(); } } }