diff --git a/CompanyManagment.App.Contracts/ContractingPartyBankAccounts/IContractingPartyBankAccountsApplication.cs b/CompanyManagment.App.Contracts/ContractingPartyBankAccounts/IContractingPartyBankAccountsApplication.cs
index b5cb171e..379f07df 100644
--- a/CompanyManagment.App.Contracts/ContractingPartyBankAccounts/IContractingPartyBankAccountsApplication.cs
+++ b/CompanyManagment.App.Contracts/ContractingPartyBankAccounts/IContractingPartyBankAccountsApplication.cs
@@ -18,6 +18,7 @@ public interface IContractingPartyBankAccountsApplication
///
///
Task Create(CreateContractingPartyBankAccounts command);
+ Task Create(List commands);
///
/// لیست اطلاعات طرف حساب بانکی
diff --git a/CompanyManagment.Application/ContractingPartyBankAccountsApplication.cs b/CompanyManagment.Application/ContractingPartyBankAccountsApplication.cs
index 2d27e049..989e9820 100644
--- a/CompanyManagment.Application/ContractingPartyBankAccountsApplication.cs
+++ b/CompanyManagment.Application/ContractingPartyBankAccountsApplication.cs
@@ -50,6 +50,38 @@ public class ContractingPartyBankAccountsApplication:IContractingPartyBankAccoun
}
+ public async Task Create(List commands)
+ {
+ var operationResult = new OperationResult();
+ foreach (var command in commands)
+ {
+ if (!_personalContractingPartyRepository.Exists(x => x.id == command.ContractingPartyId))
+ return operationResult.Failed("طرف حساب مورد نظر یافت نشد");
+
+ if (string.IsNullOrWhiteSpace(command.CardNumber))
+ return operationResult.Failed("شماره کارت خود را وارد کنید");
+
+ if (string.IsNullOrWhiteSpace(command.AccountNumber))
+ return operationResult.Failed("شماره حساب خود را وارد کنید");
+
+ if (string.IsNullOrWhiteSpace(command.IBan))
+ return operationResult.Failed("شماره شبا خود را وارد کنید");
+
+ if (string.IsNullOrWhiteSpace(command.AccountHolderName))
+ return operationResult.Failed("نام صاحب حساب را وارد کنید");
+
+ var entity = new ContractingPartyBankAccount(command.ContractingPartyId, command.CardNumber,
+ command.AccountHolderName,command.AccountNumber, command.IBan,command.IsAuth);
+
+ await _contractingPartyBankAccountsRepository.CreateAsync(entity);
+ }
+ await _contractingPartyBankAccountsRepository.SaveChangesAsync();
+
+ return operationResult.Succcedded();
+
+
+ }
+
public async Task GetList(
ContractingPartyBankAccountSearchModel searchModel)
{
diff --git a/ServiceHost/Areas/Admin/Controllers/ContractingPartyBankAccountController.cs b/ServiceHost/Areas/Admin/Controllers/ContractingPartyBankAccountController.cs
index 88b15ad3..d6e5c13c 100644
--- a/ServiceHost/Areas/Admin/Controllers/ContractingPartyBankAccountController.cs
+++ b/ServiceHost/Areas/Admin/Controllers/ContractingPartyBankAccountController.cs
@@ -37,9 +37,9 @@ public class ContractingPartyBankAccountController : AdminBaseController
///
///
[HttpPost]
- public async Task Create([FromBody] CreateContractingPartyBankAccounts command)
+ public async Task Create([FromBody] List commands)
{
- var operationResult = await _contractingPartyBankAccountsApplication.Create(command);
+ var operationResult = await _contractingPartyBankAccountsApplication.Create(commands);
return operationResult;
}