Add consumption entity and use strongly typed ids

This commit is contained in:
2024-08-17 18:00:23 +02:00
parent 4bfc57ef9f
commit d47e4c1971
19 changed files with 265 additions and 36 deletions

View File

@@ -18,14 +18,14 @@ public static class GetCar
ApplicationDbContext dbContext,
CancellationToken cancellationToken)
{
var car = await dbContext.Cars.FindAsync([id], cancellationToken: cancellationToken);
var car = await dbContext.Cars.FindAsync([new CarId(id)], cancellationToken: cancellationToken);
if (car is null)
{
return TypedResults.NotFound();
}
var response = new Response(car.Id, car.Name);
var response = new Response(car.Id.Value, car.Name);
return TypedResults.Ok(response);
}
}