新增違規次數多的API
This commit is contained in:
parent
e210b04ef3
commit
c85f06c8f2
|
@ -179,6 +179,31 @@ namespace WebApi_data_value.Controllers
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region
|
||||||
|
/// <summary>
|
||||||
|
/// 尋找違規次數最多
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("recidivists")]
|
||||||
|
public async Task<IEnumerable<object>> GetRecidivists()
|
||||||
|
{
|
||||||
|
|
||||||
|
var plateNumberOccurrences = await _context.violation_car_table
|
||||||
|
.GroupBy(c => c.license_plate_number)
|
||||||
|
.Select(group => new
|
||||||
|
{
|
||||||
|
LicensePlateNumber = group.Key,
|
||||||
|
Occurrences = group.Count()
|
||||||
|
})
|
||||||
|
.OrderByDescending(x => x.Occurrences)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
|
return plateNumberOccurrences;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region 新增違規車輛
|
#region 新增違規車輛
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 新增違規車輛
|
/// 新增違規車輛
|
||||||
|
|
Loading…
Reference in New Issue
Block a user