ASP.NET Core 2.x doesn’t have InternalServerError method. Instead you can include the following library.
using Microsoft.AspNetCore.Http;
And then use the following code.
return new StatusCodeResult(StatusCodes.Status500InternalServerError);
Or if you want to add the exception along with the response, try the following code
var result = StatusCode(StatusCodes.Status500InternalServerError, exception);
return result;