public async Task <IActionResult> Index(DateTime?planningDate) { return(await _resiliencyHelper.ExecuteResilient(async() => { if (planningDate == null) { planningDate = DateTime.Now.Date; } var model = new WorkshopManagementViewModel { Date = planningDate.Value, MaintenanceJobs = new List <MaintenanceJob>() }; // get planning string dateStr = planningDate.Value.ToString("yyyy-MM-dd"); WorkshopPlanning planning = await _workshopManagementAPI.GetWorkshopPlanning(dateStr); if (planning?.Jobs?.Count > 0) { model.MaintenanceJobs.AddRange(planning.Jobs.OrderBy(j => j.StartTime)); } return View(model); }, View("Offline", new WorkshopManagementOfflineViewModel()))); }
public async Task <IActionResult> Register([FromForm] VehicleOwnerManagementNewViewModel inputModel) { try { if (ModelState.IsValid) { return(await _resiliencyHelper.ExecuteResilient(async() => { RegisterOwner cmd = new RegisterOwner(new Guid(), inputModel.Owner.OwnerId, inputModel.Owner.RazonSocial, inputModel.Owner.CIF, inputModel.Owner.Direccion, inputModel.Owner.Contacto, inputModel.Owner.Telefono); await _vehicleManagementAPI.RegisterOwner(cmd); return RedirectToAction("Index"); }, View("Offline", new VehicleOwnerManagementOfflineViewModel()))); } else { return(View("New", inputModel)); } } catch (Exception ex) { return(View("Offline", new VehicleOwnerManagementOfflineViewModel())); } }
public async Task <IActionResult> Index() { return(await _resiliencyHelper.ExecuteResilient(async() => { var model = new CustomerManagementViewModel { Customers = await _customerManagementAPI.GetCustomers() }; return View(model); }, View("Offline", new CustomerManagementOfflineViewModel()))); }
public async Task <IActionResult> Index() { return(await _resiliencyHelper.ExecuteResilient(async() => { var model = new VehicleInsuranceManagementViewModel { Insurances = await _vehicleManagementAPI.GetInsurances() }; return View(model); }, View("Offline", new VehicleInsuranceManagementOfflineViewModel()))); }