針對成員新增API進行車牌確認
This commit is contained in:
parent
32b780ea92
commit
26c69c10b4
@ -120,24 +120,34 @@ 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.");
|
||||||
}
|
}
|
||||||
_context.yuntech_parking_user_list.Add(yuntech_parking_user_list);
|
var license_plate_number = yuntech_parking_user_list.user_license_plate_number;
|
||||||
try
|
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)
|
||||||
{
|
{
|
||||||
await _context.SaveChangesAsync();
|
_context.yuntech_parking_user_list.Add(yuntech_parking_user_list);
|
||||||
}
|
try
|
||||||
catch (DbUpdateException)
|
|
||||||
{
|
|
||||||
if (Yuntech_parking_user_listExists(yuntech_parking_user_list.user_license_plate_number))
|
|
||||||
{
|
{
|
||||||
return Conflict();
|
await _context.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
else
|
catch (DbUpdateException)
|
||||||
{
|
{
|
||||||
throw;
|
if (Yuntech_parking_user_listExists(yuntech_parking_user_list.user_license_plate_number))
|
||||||
|
{
|
||||||
|
return Conflict();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Ok("ok");
|
||||||
}
|
}
|
||||||
|
|
||||||
return CreatedAtAction("GetYuntech_parking_user_list", new { id = yuntech_parking_user_list.user_license_plate_number }, yuntech_parking_user_list);
|
return Ok("車牌重複");
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user