public IHttpActionResult GetShortenPatient(int patientID)
        {
            ShortenPatient bn = dao.GetShortenPatient(patientID);

            if (bn == null)
            {
                return(NotFound());
            }
            return(Ok(bn));
        }
Beispiel #2
0
        public ShortenPatient InforPatient(int patientID)
        {
            ShortenPatient bn = null;

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(baseAddress);
                //HTTP GET
                var responseTask = client.GetAsync("Patient?patientID=" + patientID);
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <ShortenPatient>();
                    readTask.Wait();
                    bn = readTask.Result;
                }
            }
            return(bn);
        }
        public ShortenPatient GetShortenPatient(int patientID)
        {
            const string        proc = "SP_TimBenhNhanTheoID";
            List <SqlParameter> para = new List <SqlParameter>()
            {
                new SqlParameter("PATIENTID", patientID)
            };
            IDataReader    reader = DataProvider.ExecuteReader(proc, para);
            ShortenPatient res    = new ShortenPatient();
            ShortenPatient lichhen;

            while (reader.Read())
            {
                lichhen             = new ShortenPatient();
                lichhen.PatientID   = Convert.ToInt32(reader["PatientID"]);
                lichhen.DateOfBirth = Convert.ToDateTime(reader["DateOfBirth"]);
                lichhen.PatientName = Convert.ToString(reader["PatientName"]);
                lichhen.Gender      = Convert.ToString(reader["Gender"]);
                res = lichhen;
            }
            return(res);
        }