public IHttpActionResult Get(int id, string doctorID) { var data = db.MedicalHistories.FirstOrDefault(b => b.ID == id && b.DoctorID == doctorID.ToString()); VM_history history = new VM_history(); history.doctorId = data.DoctorID; history.doctorName = db.doctors.Where(o => o.userId == data.DoctorID).FirstOrDefault().name; history.sickness = data.Sickness; history.checkupPrice = data.CheckUpPrice; history.description = data.DescriptionInfo; history.date = data.CheckUpDate; history.patientId = data.PatientID; history.patientName = data.Patient.Name; return(Ok(history)); }
/*get detail history from history id*/ public VM_history detailHistory(int?id, string doctorID) { VM_history dataHistory = new VM_history(); var client = new HttpClient(); client.BaseAddress = new Uri(baseUrl); client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage Res = client.GetAsync("api/History/" + id + "?doctorID=" + doctorID).Result; if (Res.IsSuccessStatusCode) { var historyResponse = Res.Content.ReadAsStringAsync().Result; dataHistory = JsonConvert.DeserializeObject <VM_history>(historyResponse); } return(dataHistory); }