public CancelReservationMobileResponse cancelReservation(CancelReservationMobileRequest cancelReservation, string token)
        {
            CancelReservationMobileResponse result = null;

            try
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(ConstantData.ApiURL.ToString() + "ReservationMobile/CancelReservationMobile");
                    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

                    var myContent   = JsonConvert.SerializeObject(cancelReservation);
                    var buffer      = Encoding.UTF8.GetBytes(myContent);
                    var byteContent = new ByteArrayContent(buffer);
                    byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");



                    var response = client.PostAsync(client.BaseAddress, byteContent).Result;
                    if (response.IsSuccessStatusCode)
                    {
                        var responseStream = response.Content.ReadAsStringAsync().Result;
                        result = JsonConvert.DeserializeObject <CancelReservationMobileResponse>(responseStream);
                    }
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
 public Error_popup(string content, CancelReservationMobileRequest cancelReservationMobileRequest, string token)
 {
     InitializeComponent();
     contentText.Text = content;
     this.cancelReservationMobileRequest = cancelReservationMobileRequest;
     this.token             = token;
     Okbtn.IsVisible        = false;
     canReserGrid.IsVisible = true;
 }
 public ViewReservation(int reservationId)
 {
     InitializeComponent();
     this.reservationId           = reservationId;
     reservationByIDMobileRequest = new GetReservationByIDMobileRequest();
     reservationByIDMobileRequest.ReservationID = reservationId;
     customerId = (int)App.Current.Properties["CustomerId"];
     token      = App.Current.Properties["currentToken"].ToString();
     cancelReservationMobileRequest = new CancelReservationMobileRequest();
 }
        private async void cancelReservation(CancelReservationMobileRequest cancelReservationMobileRequest, string token)
        {
            ReservationController           reservationController = new ReservationController();
            CancelReservationMobileResponse response = null;

            bool cancelConfirm = await DisplayAlert("Alert", "Are you sure want to cancel reservation", "Confirm", "Back");

            if (cancelConfirm)
            {
                bool busy = false;
                if (!busy)
                {
                    try
                    {
                        busy = true;
                        await PopupNavigation.Instance.PushAsync(new LoadingPopup("Cancelling Reservation"));

                        await Task.Run(() =>
                        {
                            response = reservationController.cancelReservation(cancelReservationMobileRequest, token);
                        });
                    }
                    finally
                    {
                        busy = false;
                        await PopupNavigation.Instance.PopAllAsync();

                        if (response.ReservationNumber != null)
                        {
                            if (Navigation.NavigationStack[Navigation.NavigationStack.Count - 2].GetType() == typeof(SummaryOfChargesPage))
                            {
                                //int c = Navigation.NavigationStack.Count;
                                //for (var counter = 1; counter < c - 2; counter++)
                                //{
                                //    Navigation.RemovePage(Navigation.NavigationStack[Navigation.NavigationStack.Count - 2]);

                                //}
                                await Navigation.PopModalAsync();
                            }

                            //if (Navigation.NavigationStack [Navigation.NavigationStack.Count - 1].GetType() == typeof(SummaryOfChargesPage))
                            //{
                            //    await Navigation.PushAsync(new HomePageDetail());
                            //}
                            else
                            {
                                await Navigation.PopModalAsync();
                            }
                        }
                    }
                }
            }
        }
        public CancelReservationMobileResponse cancelReservation(CancelReservationMobileRequest cancelReservation, string token)
        {
            CancelReservationMobileResponse mobileResponse = null;

            try
            {
                mobileResponse = reservationservice.cancelReservation(cancelReservation, token);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(mobileResponse);
        }