Feat:init ContractingPartyBankAccount Module
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using Company.Domain.ContarctingPartyAgg;
|
||||
using Company.Domain.ContractingPartyBankAccountsAgg;
|
||||
using CompanyManagment.App.Contracts.ContractingPartyBankAccounts;
|
||||
using CompanyManagment.App.Contracts.PersonalContractingParty;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
public class ContractingPartyBankAccountsApplication:IContractingPartyBankAccountsApplication
|
||||
{
|
||||
private readonly IContractingPartyBankAccountsRepository _contractingPartyBankAccountsRepository;
|
||||
private readonly IPersonalContractingPartyRepository _personalContractingPartyRepository;
|
||||
|
||||
public ContractingPartyBankAccountsApplication(IContractingPartyBankAccountsRepository contractingPartyBankAccountsRepository,
|
||||
IPersonalContractingPartyRepository personalContractingPartyRepository)
|
||||
{
|
||||
_contractingPartyBankAccountsRepository = contractingPartyBankAccountsRepository;
|
||||
_personalContractingPartyRepository = personalContractingPartyRepository;
|
||||
}
|
||||
|
||||
public async Task<OperationResult> Create(CreateContractingPartyBankAccounts command)
|
||||
{
|
||||
var operationResult = new OperationResult();
|
||||
|
||||
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<OperationResult<List<GetContractingPartyBankAccountViewModel>>> GetList(
|
||||
ContractingPartyBankAccountSearchModel searchModel)
|
||||
{
|
||||
return await _contractingPartyBankAccountsRepository.GetList(searchModel);
|
||||
}
|
||||
|
||||
public async Task<OperationResult<List<string>>> ContractingPartyOrAccountHolderNameSelectList(string search,
|
||||
string selected)
|
||||
{
|
||||
return await _contractingPartyBankAccountsRepository.ContractingPartyOrAccountHolderNameSelectList(search, selected);
|
||||
}
|
||||
|
||||
public async Task<OperationResult<List<string>>> CardNumberSelectList(string search, string selected)
|
||||
{
|
||||
return await _contractingPartyBankAccountsRepository.CardNumberSelectList(search, selected);
|
||||
}
|
||||
|
||||
public async Task<OperationResult<List<string>>> IBanSelectList(string search, string selected)
|
||||
{
|
||||
return await _contractingPartyBankAccountsRepository.IBanSelectList(search, selected);
|
||||
}
|
||||
|
||||
public async Task<OperationResult<List<string>>> AccountNumberSelectList(string search, string selected)
|
||||
{
|
||||
return await _contractingPartyBankAccountsRepository.AccountNumberSelectList(search, selected);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user