Exemplo n.º 1
0
        public AppointmentBookingPage()
        {
            InitializeComponent();
            NavigationPage.SetHasNavigationBar(this, false);
            _apiServices = new RestApi();
            _objBookAppointmentRequestModel  = new BookAppointmentRequestModel();
            _objBookAppointmentResponseModel = new BookAppointmentResponseModel();
            _objDepartmentListRequestModel   = new DepartmentListRequestModel();
            _objDepartmentListResponseModel  = new DepartmentListResponseModel();
            _objDoctorListRequestModel       = new DoctorListRequestModel();
            _objDoctorListResponseModel      = new DoctorListResponseModel();
            _objReason4VisitResponseModel    = new Reason4VisitResponseModel();
            _objHeaderModel          = new HeaderModel();
            _objHeaderModel.OTPToken = Settings.TokenCode;

            _baseurlDeptList = Settings.Url + Domain.DepartmentApiConstant;
            _baseUrlDocList  = Settings.Url + Domain.DoctorDetailApiConstant;
            _reason4VisitUrl = Settings.Url + Domain.GetReasonForVisitApiConstant;

            GetReason4Visit();
            listDoctorListByDept.ItemSelected += ListDoctorListByDept_ItemSelected;
        }
Exemplo n.º 2
0
        public async Task <DepartmentListResponseModel> DepartmentListAsync(string uri, Boolean IsHeaderRequired, HeaderModel objHeaderModel, DepartmentListRequestModel _objDepartmentListRequestModel)
        {
            DepartmentListResponseModel objDepartmentListResponseModel;
            string s = JsonConvert.SerializeObject(_objDepartmentListRequestModel);
            HttpResponseMessage response = null;

            using (var stringContent = new StringContent(s, System.Text.Encoding.UTF8, "application/json"))
            {
                if (IsHeaderRequired)
                {
                    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", objHeaderModel.OTPToken);
                }
                response = await client.PostAsync(uri, stringContent);


                if (response.IsSuccessStatusCode)
                {
                    var SucessResponse = await response.Content.ReadAsStringAsync();

                    objDepartmentListResponseModel = JsonConvert.DeserializeObject <DepartmentListResponseModel>(SucessResponse);
                    return(objDepartmentListResponseModel);
                }
                else
                {
                    var ErrorResponse = await response.Content.ReadAsStringAsync();

                    objDepartmentListResponseModel = JsonConvert.DeserializeObject <DepartmentListResponseModel>(ErrorResponse);
                    return(objDepartmentListResponseModel);
                }
            }
        }