From 8faddedd467f865e69f71dcbc4734252bfb83843 Mon Sep 17 00:00:00 2001 From: mahan Date: Wed, 14 Jan 2026 17:45:03 +0330 Subject: [PATCH] add create and edit controller api --- .../GetEmployeeBankInfoDetailsBankItemDto.cs | 1 + .../EmployeeBankInformationApplication.cs | 6 +-- .../EmployeeBankInformationRepository.cs | 3 +- .../Controllers/EmployeeBankInfoController.cs | 38 ++++++++++++++----- 4 files changed, 33 insertions(+), 15 deletions(-) diff --git a/CompanyManagment.App.Contracts/EmployeeBankInformation/GetEmployeeBankInfoDetailsBankItemDto.cs b/CompanyManagment.App.Contracts/EmployeeBankInformation/GetEmployeeBankInfoDetailsBankItemDto.cs index 23cb6145..1654da19 100644 --- a/CompanyManagment.App.Contracts/EmployeeBankInformation/GetEmployeeBankInfoDetailsBankItemDto.cs +++ b/CompanyManagment.App.Contracts/EmployeeBankInformation/GetEmployeeBankInfoDetailsBankItemDto.cs @@ -2,6 +2,7 @@ namespace CompanyManagment.App.Contracts.EmployeeBankInformation; public class GetEmployeeBankInfoDetailsBankItemDto { + public long Id { get; set; } public string CardNumber { get; set; } public string ShebaNumber { get; set; } public string BankAccountNumber { get; set; } diff --git a/CompanyManagment.Application/EmployeeBankInformationApplication.cs b/CompanyManagment.Application/EmployeeBankInformationApplication.cs index d955d967..8414cdc2 100644 --- a/CompanyManagment.Application/EmployeeBankInformationApplication.cs +++ b/CompanyManagment.Application/EmployeeBankInformationApplication.cs @@ -108,8 +108,7 @@ namespace CompanyManagment.Application return await _employeeBankInformationRepository.SearchAsync(workshopId, searchParams); } - - //todo: add CardNumber, BankAccountNumber, etc validations + public OperationResult Edit(EditEmployeeInformation command) { OperationResult op = new(); @@ -264,8 +263,7 @@ namespace CompanyManagment.Application return !workshopRecords.Exists(x => x.WorkshopId == workshopId && x.EmployeeId == employeeId); } - - + #endregion } } diff --git a/CompanyManagment.EFCore/Repository/EmployeeBankInformationRepository.cs b/CompanyManagment.EFCore/Repository/EmployeeBankInformationRepository.cs index 461a4976..27a563d0 100644 --- a/CompanyManagment.EFCore/Repository/EmployeeBankInformationRepository.cs +++ b/CompanyManagment.EFCore/Repository/EmployeeBankInformationRepository.cs @@ -381,7 +381,8 @@ public class EmployeeBankInformationRepository : RepositoryBase>> GetList(EmployeeBankInformationSearchModel searchModel) + public async Task>> GetList( + EmployeeBankInformationSearchModel searchModel) { - return await _employeeBankInformationApplication.SearchAsync(_workshopId, searchModel); - } - - [HttpGet("{employeeId:long}")] - public async Task GetDetails(long employeeId) - { - return await _employeeBankInformationApplication.GetDetailsByEmployeeIdAsync(_workshopId,employeeId); + return await _employeeBankInformationApplication.SearchAsync(_workshopId, searchModel); } + [HttpGet("{employeeId:long}")] + public async Task> GetDetails(long employeeId) + { + return await _employeeBankInformationApplication.GetDetailsByEmployeeIdAsync(_workshopId, employeeId); + } + + public ActionResult Create(CreateEmployeeInformation command) + { + command.WorkshopId = _workshopId; + return _employeeBankInformationApplication.Create(command); + } + + public ActionResult Edit(EditEmployeeInformation command) + { + command.WorkshopId = _workshopId; + return _employeeBankInformationApplication.Edit(command); + } + + public ActionResult Remove(long id) + { + return _employeeBankInformationApplication.Remove(id); + } } \ No newline at end of file