public IHttpActionResult GetInfor(int accountID)
        {
            EmployeeShorten res = dao.GETlinfor(accountID);

            if (res.EmployeeName == "")
            {
                return(NotFound());
            }
            return(Ok(res));
        }
Exemple #2
0
        public EmployeeShorten GETlinfor(int accountID)
        {
            const string        proc = "HienThiNguoiDangNhap";
            List <SqlParameter> para = new List <SqlParameter>()
            {
                new SqlParameter("ACCOUNTID", accountID)
            };
            IDataReader     reader = DataProvider.ExecuteReader(proc, para);
            EmployeeShorten res    = new EmployeeShorten();

            while (reader.Read())
            {
                res.EmployeeID   = Convert.ToInt32(reader["EmployeeID"]);
                res.EmployeeName = Convert.ToString(reader["EmployeeName"]);
                res.Position     = Convert.ToString(reader["Position"]);
            }
            return(res);
        }
        public EmployeeShorten ShowInforUser(int accountID)
        {
            EmployeeShorten nv = null;

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

                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <EmployeeShorten>();
                    readTask.Wait();
                    nv = readTask.Result;
                }
                else
                {
                }
            }
            return(nv);
        }