針對成員新增API進行車牌確認

This commit is contained in:
威勝 張 2024-05-22 09:36:11 +08:00
parent 32b780ea92
commit 26c69c10b4

View File

@ -120,6 +120,13 @@ namespace WebApi_data_value.Controllers
{ {
return Problem("Entity set 'SqlContext.yuntech_parking_user_list' is null."); return Problem("Entity set 'SqlContext.yuntech_parking_user_list' is null.");
} }
var license_plate_number = yuntech_parking_user_list.user_license_plate_number;
var data = await(from c in _context.yuntech_parking_user_list
where c.user_license_plate_number == license_plate_number
select c
).FirstOrDefaultAsync();
if (data == null)
{
_context.yuntech_parking_user_list.Add(yuntech_parking_user_list); _context.yuntech_parking_user_list.Add(yuntech_parking_user_list);
try try
{ {
@ -137,7 +144,10 @@ namespace WebApi_data_value.Controllers
} }
} }
return CreatedAtAction("GetYuntech_parking_user_list", new { id = yuntech_parking_user_list.user_license_plate_number }, yuntech_parking_user_list); return Ok("ok");
}
return Ok("車牌重複");
} }
#endregion #endregion