I want to create endpoint which return the data by username(string).
Finding by id is working. It list the data with the given id.
app.MapGet("/store/{id}", async (StoreDb db, int id) => await db.Stores.FindAsync(id))
.RequireAuthorization();
But using name(string) is not working.
app.MapGet("/store/{name}", async (StoreDb db, string name) => await db.Stores.FindAsync(name))
.RequireAuthorization();
Schema :
Store {
id integer($int32)
name string
}
Json :
{
"id": 0,
"name": "string"
}