Exemplo n.º 1
0
 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()));
     }
 }
Exemplo n.º 2
0
        public async Task <IActionResult> Register([FromForm] VehicleOwnerManagementNewViewModel inputModel)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    RegisterOwner cmd = Mapper.Map <RegisterOwner>(inputModel.Owner);
                    await _vehicleManagementAPI.RegisterOwner(cmd);

                    return(RedirectToAction("Index"));
                }
                catch (Exception ex)
                {
                    return(View("Offline", new VehicleOwnerManagementOfflineViewModel(ex.Message)));
                }
            }
            else
            {
                return(View("New", inputModel));
            }
        }
Exemplo n.º 3
0
 public async Task RegisterOwner(RegisterOwner command)
 {
     await _client.RegisterOwner(command);
 }