@@ -49,11 +49,12 @@ public async Task<IActionResult> Index(int? pageNumber, string? searchString, Da
49
49
r . Comments ,
50
50
Status = ( ( StatusForDto ) r . Status ) switch
51
51
{
52
- StatusForDto . Pending => "Pending" ,
53
- StatusForDto . Completed => "Completed" ,
54
- StatusForDto . Rejected => "Rejected" ,
55
- StatusForDto . Unassigned => "Unassigned" ,
56
- _ => "Unknown Status"
52
+ StatusForDto . Pending => "Kutilmoqda" ,
53
+ StatusForDto . Completed => "Yakunlangan" ,
54
+ StatusForDto . Rejected => "Rad etilgan" ,
55
+ StatusForDto . Unassigned => "Yaratilmagan" ,
56
+ StatusForDto . RejectedByDriver => "Haydovchi tomonidan rad etilgan" ,
57
+ _ => "No`malum holat"
57
58
}
58
59
} ) . ToList ( ) ;
59
60
@@ -185,23 +186,22 @@ public async Task<IActionResult> GetCarByDriverId(int driverId)
185
186
[ ValidateAntiForgeryToken ]
186
187
public async Task < IActionResult > Create ( [ Bind ( "OilAmount,Comments,Status,Date,OperatorId,DriverId,CarId,OilMarks,IsGiven" ) ] OperatorReviewForCreateDto operatorReview )
187
188
{
188
-
189
189
if ( ModelState . IsValid )
190
190
{
191
191
operatorReview . Date = DateTime . Now ;
192
- var car = _carDataStore . GetCarAsync ( operatorReview . CarId ) ;
192
+ var car = await _carDataStore . GetCarAsync ( operatorReview . CarId ) ;
193
193
var carr = new CarForUpdateDto
194
194
{
195
195
Id = operatorReview . CarId ,
196
- Color = car . Result . Color ,
197
- FuelTankCapacity = car . Result . FuelTankCapacity ,
198
- ManufacturedYear = car . Result . ManufacturedYear ,
199
- MeduimFuelConsumption = car . Result . MeduimFuelConsumption ,
200
- Model = car . Result . Model ,
201
- Number = car . Result . Number ,
202
- RemainingFuel = car . Result . RemainingFuel + operatorReview . OilAmount ,
196
+ Color = car . Color ,
197
+ FuelTankCapacity = car . FuelTankCapacity ,
198
+ ManufacturedYear = car . ManufacturedYear ,
199
+ MeduimFuelConsumption = car . MeduimFuelConsumption ,
200
+ Model = car . Model ,
201
+ Number = car . Number ,
202
+ RemainingFuel = car . RemainingFuel + operatorReview . OilAmount ,
203
203
} ;
204
-
204
+
205
205
double maxOilAmount = await GetMaxOilAmount ( operatorReview . CarId ) ;
206
206
207
207
if ( ( operatorReview . OilAmount < 0 && operatorReview . IsGiven == true ) ||
@@ -215,6 +215,7 @@ public async Task<IActionResult> Create([Bind("OilAmount,Comments,Status,Date,Op
215
215
}
216
216
else
217
217
{
218
+ operatorReview . Status = operatorReview . IsGiven ? StatusForDto . Pending : StatusForDto . Rejected ;
218
219
await _carDataStore . UpdateCarAsync ( operatorReview . CarId , carr ) ;
219
220
await _operatorReviewDataStore . CreateOperatorReview ( operatorReview ) ;
220
221
return RedirectToAction ( nameof ( PersonalIndex ) ) ;
0 commit comments