Add consumption entity and use strongly typed ids
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user