예제 #1
0
        public void OnGet()
        {
            DatastoreDb db = GoogleCloudDatastore.CreateDb();

            // 查詢現有貝工
            Query query       = new Query("Employee");
            var   allEmployee = db.RunQueryLazily(query);
            int   count       = allEmployee.Count();

            Employees = allEmployee.ToList();

            Message = "員工資料新增/修改/刪除作業";
        }
예제 #2
0
        public Employee Get(long id)
        {
            DatastoreDb db = GoogleCloudDatastore.CreateDb();

            Entity employeeEntity = db.Lookup(GoogleCloudDatastore.ToKey(id, "Employee"));

            if (employeeEntity != null)
            {
                return(new Employee(employeeEntity));
            }
            else
            {
                return(null);
            }
        }
예제 #3
0
        public IEnumerable <Employee> Get()
        {
            List <Employee> EmployeeList = new List <Employee>();
            DatastoreDb     Db           = GoogleCloudDatastore.CreateDb();

            // 查詢現有貝工
            Query QueryInstance = new Query("Employee");
            var   AllEmployee   = Db.RunQueryLazily(QueryInstance);

            foreach (Entity EntityInstance in AllEmployee.ToList())
            {
                EmployeeList.Add(new Employee(EntityInstance));
            }

            return(EmployeeList);
        }