diff --git a/WebApi_data_value/Controllers/Yuntech_in_car_tableController.cs b/WebApi_data_value/Controllers/Yuntech_in_car_tableController.cs index f76b0b2..abac20c 100644 --- a/WebApi_data_value/Controllers/Yuntech_in_car_tableController.cs +++ b/WebApi_data_value/Controllers/Yuntech_in_car_tableController.cs @@ -48,6 +48,31 @@ namespace WebApi_data_value.Controllers } #endregion + + #region 獲取進入雲科的100筆資料 + /// + /// 獲取進入雲科的100筆資料 + /// + // GET: api/Yuntech_in_car_table + [HttpGet("Amount-{num}")] + public async Task>> Getyuntech_in_car_100_table(int num) + { + var in_car_table = await (from c in _context.yuntech_in_car_table + orderby c.in_time descending + select new Yuntech_in_car_table + { + license_plate_number = c.license_plate_number, + in_time = c.in_time, + out_time = c.out_time, + location = c.location, + } + ).Skip(num).Take(100).ToListAsync(); + + + return in_car_table; + } + #endregion + #region 獲取進入的單獨地區的所有資料 /// /// 獲取進入的單獨地區的所有資料 diff --git a/WebApi_data_value/Program.cs b/WebApi_data_value/Program.cs index c6e436a..d8dc62b 100644 --- a/WebApi_data_value/Program.cs +++ b/WebApi_data_value/Program.cs @@ -17,8 +17,8 @@ builder.Services.AddCors(); builder.Services.AddControllers(); // 連線PostgreSQL資料庫 -var connectionString = "Server=140.125.20.183;UserID=postgres;password=EL404el404;Database=postgres;port=5432;Search Path=public;CommandTimeout=1800"; -//var connectionString = "Server=127.0.0.1;UserID=postgres;password=EL404el404;Database=postgres;port=5432;Search Path=public;CommandTimeout=1800"; +//var connectionString = "Server=140.125.20.183;UserID=postgres;password=EL404el404;Database=postgres;port=5432;Search Path=public;CommandTimeout=1800"; +var connectionString = "Server=127.0.0.1;UserID=postgres;password=EL404el404;Database=postgres;port=5432;Search Path=public;CommandTimeout=1800"; builder.Services.AddDbContext(opt => opt.UseNpgsql(connectionString));