This is my Minimal API (.NET 8):
app.MapPost("check", async ([FromBody] UserClaims claims, ApplicationDbContext dbContext) =>
{
var result = await dbContext.Users.SingleOrDefaultAsync(x => x.Phone == claims.Phone);
if (result is null)
return TypedResults.NotFound();
return TypedResults.Ok();
});
I am getting a CS1593 error under my lambda expression.
What am I doing wrong ?
Removing the following part from my API solves the problem:
if (result is null)
return TypedResults.NotFound();
Also, replacing TypedResults
with Results
solves the problem.
Is there a restriction when using TypedResults
?