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

@@ -42,7 +42,7 @@ public static class UpdateCar
return TypedResults.BadRequest(new HttpValidationProblemDetails(failedValidations.ToCombinedDictionary()));
}
var car = await dbContext.Cars.FindAsync([id], cancellationToken: cancellationToken);
Car? car = await dbContext.Cars.FindAsync([new CarId(id)], cancellationToken: cancellationToken);
if (car is null)
{
@@ -52,7 +52,7 @@ public static class UpdateCar
car.Name = request.Name;
await dbContext.SaveChangesAsync(cancellationToken);
Response response = new(car.Id, car.Name);
Response response = new(car.Id.Value, car.Name);
return TypedResults.Ok(response);
}
}