public async Task <IActionResult> RegisterAndPlanMaintenanceJob([FromForm] WorkShopManagementNewVM inputModel) { if (ModelState.IsValid) { string emailAddress = inputModel.Customer.EmailAddress; string licenseNumber = inputModel.Vehicle.LicenseNumber; HttpResponseMessage customerResponse = await _customerAPI.Register(inputModel.Customer); if (ShowErrorIfRequired(customerResponse, out var customerError)) { return(customerError); } HttpResponseMessage vehicleApiResponse = await _vehicleAPI.Register(inputModel.Vehicle, emailAddress); await CompensateIfRequired(inputModel, vehicleApiResponse); if (ShowErrorIfRequired(vehicleApiResponse, out var vehicleError)) { return(vehicleError); } HttpResponseMessage workShopApiResponse = await _workshopAPI.RegisterPlanning(inputModel.MaintenanceJob, emailAddress, licenseNumber); await CompensateIfRequired(inputModel, workShopApiResponse); if (ShowErrorIfRequired(workShopApiResponse, out var workShopError)) { return(workShopError); } await Notify(emailAddress); TempData["SuccessMessage"] = "Success! Please check your email to see the Maintenance Job Detail."; return(RedirectToAction("Index")); } else { return(View("New", inputModel)); } }