Validate ride meter end
This commit is contained in:
@@ -141,6 +141,9 @@ public class RideService(
|
|||||||
if (ride.Status != RideStatus.Active)
|
if (ride.Status != RideStatus.Active)
|
||||||
throw new InvalidOperationException($"Cannot close a ride in {ride.Status} status");
|
throw new InvalidOperationException($"Cannot close a ride in {ride.Status} status");
|
||||||
|
|
||||||
|
if (request.Meterend < ride.Meterstart)
|
||||||
|
throw new InvalidOperationException($"Meter end ({request.Meterend}) cannot be less than meter start ({ride.Meterstart})");
|
||||||
|
|
||||||
await EnsureVehicleStockClearedAsync(ride.FK_VehicleId);
|
await EnsureVehicleStockClearedAsync(ride.FK_VehicleId);
|
||||||
|
|
||||||
ride.Status = RideStatus.Closed;
|
ride.Status = RideStatus.Closed;
|
||||||
|
|||||||
Reference in New Issue
Block a user