public async Task CheckAndSendRatings(bool sendRatingButtonWasPressed = false) { if (!Settings.RatingEnabled || HasRated) { return; } if (RatingList == null) { // Prevent the user from getting stuck on this screen HasRated = true; return; } if (RatingList.Any(c => c.Score == 0)) { if (Settings.RatingRequired || // button was pressed, send feedback to user in case of error (Settings.RatingRequired && sendRatingButtonWasPressed)) // CheckAndSendRatings is also called when exiting the view { this.Services().Message.ShowMessage(this.Services().Localize["BookRatingErrorTitle"], this.Services().Localize["BookRatingErrorMessage"]); } // We don't send the review since it's not complete. The user will have the // possibility to go back to the order history to rate it later if he so desires return; } try { var orderRating = new OrderRatings { Note = Note, OrderId = OrderId, RatingScores = RatingList.Select( c => new RatingScore { RatingTypeId = c.RatingTypeId, Score = c.Score, Name = c.RatingTypeName }).ToList() }; await _bookingService.SendRatingReview(orderRating); } catch (Exception ex) { Logger.LogMessage("Error while SendRatingReview"); Logger.LogError(ex); } HasRated = true; CanRate = false; }
public async Task CheckAndSendRatings() { if (!Settings.RatingEnabled || _hasRated) { return; } if (_ratingList.Any(c => c.Score == 0)) { if (Settings.RatingRequired) { this.Services().Message.ShowMessage(this.Services().Localize["BookRatingErrorTitle"], this.Services().Localize["BookRatingErrorMessage"]); return; } return; } var orderRating = new OrderRatings { Note = Note, OrderId = OrderId, RatingScores = _ratingList.Select( c => new RatingScore { RatingTypeId = c.RatingTypeId, Score = c.Score, Name = c.RatingTypeName }).ToList() }; await _bookingService.SendRatingReview(orderRating); _hasRated = true; }