【发布时间】:2023-01-11 12:58:00
【问题描述】:
当我尝试实现 get by id SPI 服务时,我得到了所有记录,而不是 ASP.NET Core Web API 中的一个特定记录。
[HttpGet("EmployeeId")]
public ActionResult<Employeedatum> Getbyid(int EmployeeId)
{
if(EmployeeId <= 0)
{
return NotFound("not found");
}
Employeedatum employeedata = DbContext.Employeedatum.FirstOrDefault(s => s.empid == EmployeeId);
if(employeedata == null)
{
return NotFound("notfound");
}
return Ok(employeedata);
【问题讨论】:
-
节目是
Employeedatum -
你能解释清楚吗?
标签: c# asp.net sql-server asp.net-mvc asp.net-web-api