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 = "員工資料新增/修改/刪除作業"; }
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); } }
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); }