Exemple #1
0
 public async Task <IActionResult> Edit([FromForm] VehicleManagementEditViewModel inputModel)
 {
     if (ModelState.IsValid)
     {
         return(await _resiliencyHelper.ExecuteResilient(async() =>
         {
             var command = inputModel.MapToUpdateVehicle();
             await _vehicleManagementAPI.UpdateVehicle(command.LicenseNumber, command);
             return RedirectToAction("Index");
         }, View("Offline", new VehicleManagementOfflineViewModel())));
     }
     else
     {
         return(View("Edit", inputModel));
     }
 }
Exemple #2
0
 public async Task <IActionResult> Update([FromForm] VehicleManagementNewViewModel inputModel)
 {
     if (ModelState.IsValid)
     {
         return(await _resiliencyHelper.ExecuteResilient(async() =>
         {
             try
             {
                 RegisterVehicle cmd = Mapper.Map <RegisterVehicle>(inputModel.Vehicle);
                 await _vehicleManagementAPI.UpdateVehicle(cmd);
                 return RedirectToAction("Index");
             }
             catch (Exception ex)
             {
                 throw ex;
             }
         }, View("Offline", new VehicleManagementOfflineViewModel())));
     }
     else
     {
         return(View("New", inputModel));
     }
 }
Exemple #3
0
 public async Task UpdateVehicle([AliasAs("licenseNumber")] string licenseNumber, UpdateVehicle command)
 {
     await _restClient.UpdateVehicle(licenseNumber, command);
 }
 public async Task UpdateVehicle(RegisterVehicle command)
 {
     await _client.UpdateVehicle(command);
 }