新增獲取進入車輛100筆

This commit is contained in:
威勝 張 2024-02-19 11:24:08 +08:00
parent 24fdc69a44
commit cd0b1ed9fa
2 changed files with 27 additions and 2 deletions

View File

@ -48,6 +48,31 @@ namespace WebApi_data_value.Controllers
}
#endregion
#region 100
/// <summary>
/// 獲取進入雲科的100筆資料
/// </summary>
// GET: api/Yuntech_in_car_table
[HttpGet("Amount-{num}")]
public async Task<ActionResult<IEnumerable<Yuntech_in_car_table>>> 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
/// <summary>
/// 獲取進入的單獨地區的所有資料

View File

@ -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<SqlContext>(opt => opt.UseNpgsql(connectionString));