From cd0b1ed9fa28d4563b096aec1bbdfb6b80683d38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A8=81=E5=8B=9D=20=E5=BC=B5?= Date: Mon, 19 Feb 2024 11:24:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=8D=B2=E5=8F=96=E9=80=B2?= =?UTF-8?q?=E5=85=A5=E8=BB=8A=E8=BC=9B100=E7=AD=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Yuntech_in_car_tableController.cs | 25 +++++++++++++++++++ WebApi_data_value/Program.cs | 4 +-- 2 files changed, 27 insertions(+), 2 deletions(-) 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));