public async Task <ActionResult> Create(AccountEditar account) { ErrorHandling errorHandling = null; if (ModelState.IsValid) { var newAccount = SetAccount(account); errorHandling = await ValidarCuenta(newAccount); if (errorHandling != null && errorHandling.faultcode != null) { ViewBag.Error = errorHandling?.faultstring; return(View(account)); } else { await CreateCuenta(newAccount); } } else { return(View(account)); } return(RedirectToAction(nameof(Index))); }
public account_info SetAccount(AccountEditar accountEditar) { var account = new account_info(); var now = DateTime.Now; var YY = now; var MM = now.Month.ToString(); var DD = now.Day.ToString(); if (MM.Length == 1) { MM = "0" + MM; } if (DD.Length == 1) { DD = "0" + DD; } var activationDate = now.Year + "-" + MM + "-" + DD; account.id = "a" + accountEditar.Telefono; account.phone1 = accountEditar.Telefono; account.iso_4217 = "USD"; account.i_customer = 260271; //Online customers account.i_distributor = 282645; //distributor customers account.batch_name = "260271-di-pinless"; account.country = "US"; account.billing_model = -1; account.control_number = 1; account.h323_password = ServicePassword; account.i_product = 22791; account.activation_date = activationDate.Trim(); account.firstname = accountEditar.Nombre; account.lastname = accountEditar.Apellido; account.balance = 0; account.email = accountEditar.Email; account.login = accountEditar.Email; account.password = "******"; return(account); }