public PrescriptionPage() { InitializeComponent(); NavigationPage.SetHasNavigationBar(this, false); _objHeaderModel = new HeaderModel(); _objHeaderModel.OTPToken = Settings.TokenCode; _baseUrl = Settings.Url + Domain.PrescriptionApiConstant; _apiServices = new RestApi(); _objPrescriptionRequestModel = new PrescriptionRequestModel(); _objPrescriptionResponseModel = new PrescriptionResponseModel(); // App.DetailPage = this; LoadPrescription(string.Empty); }
public HomePage() { InitializeComponent(); NavigationPage.SetHasNavigationBar(this, false); _apiServices = new RestApi(); _baseUrl = Settings.Url + Domain.AppointmentApiConstant; _baseUrlPrescription = Settings.Url + Domain.PrescriptionApiConstant; _baseUrlReports = Settings.Url + Domain.ReportApiConstant; _objAppointmentResponseModel = new AppointmentResponseModel(); _objAppointmentRequestModel = new AppointmentRequestModel(); _objPrescriptionRequestModel = new PrescriptionRequestModel(); _objPrescriptionResponseModel = new PrescriptionResponseModel(); _objReportRequestModel = new ReportRequestModel(); _objReportResponseModel = new ReportResponseModel(); _objHeaderModel = new HeaderModel(); //App.DetailPage = this; _objHeaderModel.OTPToken = Settings.TokenCode; }
public async Task <PrescriptionResponseModel> GetPrescriptionListAsync(string uri, Boolean IsHeaderRequired, HeaderModel objHeaderModel, PrescriptionRequestModel _objPrescriptionRequestModel) { PrescriptionResponseModel objPrescriptionResponseModel; string s = JsonConvert.SerializeObject(_objPrescriptionRequestModel); 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(); objPrescriptionResponseModel = JsonConvert.DeserializeObject <PrescriptionResponseModel>(SucessResponse); return(objPrescriptionResponseModel); } else { var ErrorResponse = await response.Content.ReadAsStringAsync(); objPrescriptionResponseModel = JsonConvert.DeserializeObject <PrescriptionResponseModel>(ErrorResponse); return(objPrescriptionResponseModel); } } }