private async void PlaceOrder_Clicked(object sender, EventArgs e) { Button button = (Button)sender; button.IsEnabled = false; try { PlaceOrderRequest placeOrderRequest = new PlaceOrderRequest() { userId = OperationData.userId, itemId = OperationData.CartItemList[0].id, sellerId = OperationData.CartItemList[0].userId, qty = Convert.ToInt32(OperationData.CartItemList[0].numberOfItems) }; var res = await cartViewModel.PlaceOrder(placeOrderRequest); if (res != null) { if (res.Code == 0) { await DisplayAlert("Success!", "Order placed successfully with order number " + res.Data.orderNumber, null, "OK"); OrderData order = new OrderData() { itemId = OperationData.CartItemList[0].id, foodName = OperationData.CartItemList[0].foodName, id = res.Data.orderId, SellerId = placeOrderRequest.sellerId }; await PopupNavigation.PushAsync(new OrderItemStarRatingPopup(order)); Application.Current.MainPage = new NavigationPage(new MainPage()); OperationData.CartItemList.Clear(); } else { await DisplayAlert("Something went wrong", "We could not place your order, Please try again.", null, "OK"); } } else { await DisplayAlert("Something went wrong", "We could not place your order, Please try again.", null, "OK"); } } catch (Exception ex) { } finally { button.IsEnabled = true; } }