async Task <bool> Book()
        {
            if (selectedSlots != null)
            {
                var timeSlots = new List <ConfirmedBookingTimeSlot>();
                foreach (var item in selectedSlots)
                {
                    timeSlots.Add(new ConfirmedBookingTimeSlot()
                    {
                        tid = item.tId
                    }
                                  );
                }

                var bookingRequest = new ReservedBookingRequest()
                {
                    remarks        = "",
                    bookingconfirm = true,
                    paymentMethod  = "NotRequired",
                    confirmedBookingTimeSlotList = timeSlots
                };

                var result = await service.ConfirmBooking(App.Current.Properties["defaultPid"].ToString(), facilityId, selectedDate, bookingRequest);

                if (result != null)
                {
                    if (result.status_code == System.Net.HttpStatusCode.Created)
                    {
                        await DisplayAlert("Success", "You have successfully booked this facility", "OK");

                        await Navigation.PushAsync(new BookingListPage());
                    }
                    else
                    {
                        await DisplayAlert("Error", result.message, "OK");
                    }
                }
                else
                {
                    await DisplayAlert("Error", Config.CommonErrorMsg, "OK");
                }
            }
            return(false);
        }
        async void Confirm(object sender, System.EventArgs e)
        {
            var title = "Do you want to book?";

            if (paymentSegment.SelectedSegment == 2)
            {
                title = "Do you want to reserve?";
            }
            string[] messageList =
            {
                "This will confirm that payment by cash was received by you for booking",
                "This will confirm that payment by NETS was done by you for booking",
                "This will reserve the booking without payment"
            };
            if (reminderSegment.SelectedSegment == 1 && selectedResidentList.Count == 0)
            {
                warningLabel.Text = "Nobody selected for reminder";
                return;
            }
            var result = await DisplayAlert(title, messageList[paymentSegment.SelectedSegment], "OK", "Cancel");

            if (result)
            {
                var paymentMethodList = new List <string>();
                paymentMethodList.Add("Cash");
                paymentMethodList.Add("Nets");
                paymentMethodList.Add("Reserve");
                var confirmedBookingSlots = new List <ConfirmedBookingTimeSlot>();
                if (booking.confirmedBookingTimeSlotList != null)
                {
                    foreach (var item in booking.confirmedBookingTimeSlotList)
                    {
                        confirmedBookingSlots.Add(new ConfirmedBookingTimeSlot()
                        {
                            tid = item.tId
                        });
                    }
                }

                string selectedDate = date.Year + "-" + date.Month + "-" + date.Day;
                var    request      = new PaidBookingRequest()
                {
                    remarks        = remarksText.Text,
                    bookingconfirm = true,
                    confirmedBookingTimeSlotList = confirmedBookingSlots,
                    paymentMethod = paymentMethodList[paymentSegment.SelectedSegment],
                    reminderList  = selectedResidentList
                };
                if (total == 0)
                {
                    request.paymentMethod = "NotRequired";
                }
                if (!fromList)
                {
                    var res = await service.ConfirmBooking(App.Current.Properties["defaultPid"].ToString(), facilityId, unitID, tenantId, selectedDate, request);

                    if (res != null)
                    {
                        if (res.status_code == System.Net.HttpStatusCode.Created)
                        {
                            await Navigation.PushAsync(new BookingListPage()
                            {
                                blockNo = this.blockNo
                            });
                        }
                        else
                        {
                            await DisplayAlert("Error", res.message, "OK");
                        }
                    }
                    else
                    {
                        await DisplayAlert("Error", Config.CommonErrorMsg, "OK");
                    }
                }
                else
                {
                    var res = await service.ConfirmPayment(App.Current.Properties["defaultPid"].ToString(), booking.bookingID, request);

                    if (res != null)
                    {
                        if (res.status_code == System.Net.HttpStatusCode.OK)
                        {
                            await Navigation.PopAsync(true);
                        }
                        else
                        {
                            await DisplayAlert("Error", res.message, "OK");
                        }
                    }
                    else
                    {
                        await DisplayAlert("Error", Config.CommonErrorMsg, "OK");
                    }
                }
            }
        }