public async Task <ActionResult> AddMerchantSetting(AddMerchantSettingDialogViewModel vm) { vm.PaymentAssets = vm.PaymentAssets ?? string.Empty; vm.SettlementAssets = vm.SettlementAssets ?? string.Empty; vm.SettlementAssets = vm.SettlementAssets.Replace(' ', ';').Replace(',', ';'); vm.PaymentAssets = vm.PaymentAssets.Replace(' ', ';').Replace(',', ';'); vm.SettlementAssets = String.Join(";", vm.SettlementAssets.Split(';').Where(x => !string.IsNullOrEmpty(x)).ToArray()); vm.PaymentAssets = String.Join(";", vm.PaymentAssets.Split(';').Where(x => !string.IsNullOrEmpty(x)).ToArray()); if (string.IsNullOrEmpty(vm.PaymentAssets)) { return(this.JsonFailResult("PaymentAssets required", ErrorMessageAnchor)); } if (string.IsNullOrEmpty(vm.SettlementAssets)) { return(this.JsonFailResult("SettlementAssets required", ErrorMessageAnchor)); } await _payInternalClient.SetAssetMerchantSettingsAsync(new UpdateAssetMerchantSettingsRequest() { MerchantId = vm.MerchantId, PaymentAssets = vm.PaymentAssets, SettlementAssets = vm.SettlementAssets }); return(this.JsonRequestResult("#merchantsSettingsList", Url.Action("MerchantsSettingsList"), new MerchantsSettingsViewModel() { SelectedMerchant = vm.MerchantId })); }
public async Task <ActionResult> AddMerchantSettingDialog(string merchant = null) { var assets = await _payInternalClient.GetAssetMerchantSettingsAsync(merchant); var vm = new AddMerchantSettingDialogViewModel { Caption = "Add assets to merchant", MerchantId = merchant, PaymentAssets = assets?.PaymentAssets ?? string.Empty, SettlementAssets = assets?.SettlementAssets ?? string.Empty, }; return(View(vm)); }