64 lines
2.6 KiB
C#
64 lines
2.6 KiB
C#
using _0_Framework.Application;
|
|
using Bogus;
|
|
using CompanyManagment.App.Contracts.ContractingPartyBankAccounts;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using ServiceHost.BaseControllers;
|
|
|
|
namespace ServiceHost.Areas.Admin.Controllers;
|
|
|
|
/// <summary>
|
|
/// کنترلر بانک اطلاعات شماره حساب
|
|
/// </summary>
|
|
public class ContractingPartyBankAccountController : AdminBaseController
|
|
{
|
|
private readonly IContractingPartyBankAccountsApplication _contractingPartyBankAccountsApplication;
|
|
|
|
public ContractingPartyBankAccountController(IContractingPartyBankAccountsApplication contractingPartyBankAccountsApplication)
|
|
{
|
|
_contractingPartyBankAccountsApplication = contractingPartyBankAccountsApplication;
|
|
}
|
|
|
|
/// <summary>
|
|
/// لیست اطلاعات بانک اطلاعات بانکی طرف حساب
|
|
/// </summary>
|
|
/// <param name="searchModel">سرچ</param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public async Task<List<GetContractingPartyBankAccountViewModel>> GetList(ContractingPartyBankAccountSearchModel searchModel)
|
|
{
|
|
var res =await _contractingPartyBankAccountsApplication.GetList(searchModel);
|
|
return res;
|
|
}
|
|
|
|
[HttpGet("fake")]
|
|
public IActionResult GetFakeBankAccounts()
|
|
{
|
|
var bankAccountsFaker = new Faker<ContractingPartyBankAccountsItemViewModel>("fa")
|
|
.RuleFor(x => x.AccountHolderName, f => f.Name.FullName())
|
|
.RuleFor(x => x.CardNumber, f => f.Finance.CreditCardNumber())
|
|
.RuleFor(x => x.AccountNumber, f => f.Finance.Account())
|
|
.RuleFor(x => x.IBan, f => $"IR{f.Random.Number(10_000_000, 99_999_999)}{f.Random.Number(10_000_000, 99_999_999)}");
|
|
|
|
var viewModelFaker = new Faker<GetContractingPartyBankAccountViewModel>("fa")
|
|
.RuleFor(x => x.ContractingPartyId, f => f.Random.Long(1000, 9999))
|
|
.RuleFor(x => x.ContractingPartyName, f => f.Company.CompanyName())
|
|
.RuleFor(x => x.WorkshopName, f => f.Address.City())
|
|
.RuleFor(x => x.BankAccountsItems, f => bankAccountsFaker.Generate(f.Random.Int(1, 5)));
|
|
|
|
var fakeData = viewModelFaker.Generate(new Random().Next(1,35));
|
|
return Ok(fakeData);
|
|
}
|
|
|
|
/// <summary>
|
|
/// ایجاد
|
|
/// </summary>
|
|
/// <param name="command"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public async Task<OperationResult> Create([FromBody] CreateContractingPartyBankAccounts command)
|
|
{
|
|
var operationResult = await _contractingPartyBankAccountsApplication.Create(command);
|
|
return operationResult;
|
|
}
|
|
|
|
} |