示例#1
0
 public async Task <IActionResult> Register([FromForm] CustomerManagementNewViewModel inputModel)
 {
     return(await ExecuteWithFallback(async() =>
     {
         RegisterCustomer cmd = Mapper.Map <RegisterCustomer>(inputModel.Customer);
         await _customerManagementAPI.RegisterCustomer(cmd);
         return RedirectToAction("Index");
     }));
 }
示例#2
0
 public async Task RegisterCustomer(RegisterCustomer command)
 {
     try
     {
         await _client.RegisterCustomer(command);
     }
     catch (System.Exception e)
     {
         throw e.InnerException;
     }
 }
 public async Task <IActionResult> Register([FromForm] CustomerManagementNewViewModel inputModel)
 {
     if (ModelState.IsValid)
     {
         return(await _resiliencyHelper.ExecuteResilient(async() =>
         {
             RegisterCustomer cmd = inputModel.MapToRegisterCustomer();
             await _customerManagementAPI.RegisterCustomer(cmd);
             return RedirectToAction("Index");
         }, View("Offline", new CustomerManagementOfflineViewModel())));
     }
     else
     {
         return(View("New", inputModel));
     }
 }
 public async Task <IActionResult> Register([FromForm] CustomerManagementNewViewModel inputModel)
 {
     if (ModelState.IsValid)
     {
         return(await _resiliencyHelper.ExecuteResilient(async() =>
         {
             //RegisterCustomer cmd = Mapper.Map<RegisterCustomer>(inputModel.Customer);
             RegisterCustomer cmd = new RegisterCustomer(new Guid(),
                                                         inputModel.Customer.CustomerId,
                                                         inputModel.Customer.EsPersona,
                                                         inputModel.Customer.Nombre,
                                                         inputModel.Customer.Pais,
                                                         inputModel.Customer.NIF,
                                                         inputModel.Customer.FechaAlta,
                                                         inputModel.Customer.FechaBaja,
                                                         inputModel.Customer.Direccion,
                                                         inputModel.Customer.PaisDireccion,
                                                         inputModel.Customer.CodigoPostal,
                                                         inputModel.Customer.Poblacion,
                                                         inputModel.Customer.Provincia,
                                                         inputModel.Customer.Telefono,
                                                         inputModel.Customer.Telefono2,
                                                         inputModel.Customer.Movil,
                                                         inputModel.Customer.FechaExpNIF,
                                                         inputModel.Customer.PoblacionExpNIF,
                                                         inputModel.Customer.FechaNacimiento,
                                                         inputModel.Customer.PoblacionNacimiento,
                                                         inputModel.Customer.TipoPermiso,
                                                         inputModel.Customer.NumeroPermiso,
                                                         inputModel.Customer.FechaExpPermiso,
                                                         inputModel.Customer.FechaCadPermiso,
                                                         inputModel.Customer.Email,
                                                         inputModel.Customer.Bloqueado,
                                                         inputModel.Customer.Moroso,
                                                         inputModel.Customer.NumeroTarjetaCred,
                                                         inputModel.Customer.TitularTarjetaCred,
                                                         inputModel.Customer.FechaCadTarjetaCred
                                                         );
             await _customerManagementAPI.RegisterCustomer(cmd);
             return RedirectToAction("Index");
         }, View("Offline", new CustomerManagementOfflineViewModel())));
     }
     else
     {
         return(View("New", inputModel));
     }
 }
 public async Task RegisterCustomer(RegisterCustomer command)
 {
     await _restClient.RegisterCustomer(command);
 }