我遇到的错误
“消息”:“发生错误。”, “ ExceptionMessage”:“ UrlHelper.Link不能返回null。 “ ExceptionType”:“ System.InvalidOperationException”,
[Route(UrlClass.createEmployee)]
[HttpPost]
public IHttpActionResult createEmployee(Employee employee)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
db.Employees.Add(employee);
try
{
db.SaveChanges();
}
catch (DbUpdateException)
{
if (EmployeeExists(employee.Employee_ID))
{
return Conflict();
}
else
{
throw;
}
}
return CreatedAtRoute("GetAction", new { id = employee.Employee_ID }, employee);
}