public ActionResult GetEmployees([DataSourceRequest] DataSourceRequest request)
 {
     EmployeeServices service = new EmployeeServices();
     var list = service.GetAllUseEntity<Sys_UserInfoEntity>(ref status);
     return Json(list.ToDataSourceResult(request)); 
     
     #region code cũ
     //EmployeeServices service = new EmployeeServices();
     //var list = service.GetEmployees();
     //return Json(list.ToDataSourceResult(request)); 
     #endregion
 }
Example #2
0
        // GET api/<controller>
        /// <summary>
        /// Lấy tất cả dữ liệu
        /// </summary>
        /// <returns></returns>
        public IEnumerable<EmployeeModel> Get()
        {
            var service = new EmployeeServices();
            var list = service.GetAllUseEntity<Sys_UserInfoEntity>(ref status);

            //Service sử dụng Sys_UserInfoEntity, phải chuyển về dạng model tương ứng khi trả về Web
            return list.Select(item => new EmployeeModel
            {
                ID = item.ID,
                Code = item.Code,
                LoginName = item.UserLogin,
                LDAPDatasource = item.LDAPDatasource,
                IsActivate = item.IsActivate
            });
        }