refactor EmployeeBankInfoController to enhance delete functionality and add set default bank API
This commit is contained in:
@@ -43,13 +43,25 @@ public class EmployeeBankInfoController : ClientBaseController
|
|||||||
command.WorkshopId = _workshopId;
|
command.WorkshopId = _workshopId;
|
||||||
return _employeeBankInformationApplication.Edit(command);
|
return _employeeBankInformationApplication.Edit(command);
|
||||||
}
|
}
|
||||||
[HttpDelete]
|
[HttpDelete("delete-by-employee/{employeeId:long}")]
|
||||||
public ActionResult<OperationResult> Remove([FromQuery]long id)
|
public ActionResult<OperationResult> Remove(long employeeId)
|
||||||
{
|
{
|
||||||
return _employeeBankInformationApplication.Remove(id);
|
return _employeeBankInformationApplication.RemoveByEmployeeId(_workshopId, employeeId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpDelete("delete-one/{id:long}")]
|
||||||
|
public IActionResult OnPostDelete(long id)
|
||||||
|
{
|
||||||
|
var result = _employeeBankInformationApplication.Remove(id);
|
||||||
|
return new JsonResult(new
|
||||||
|
{
|
||||||
|
success = result.IsSuccedded,
|
||||||
|
message = result.Message,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost("excel")]
|
||||||
public ActionResult DownloadExcel([FromBody]DownloadExcelRequest request)
|
public ActionResult DownloadExcel([FromBody]DownloadExcelRequest request)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -74,6 +86,19 @@ public class EmployeeBankInfoController : ClientBaseController
|
|||||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||||
$"اطلاعات بانکی پرسنل.xlsx");
|
$"اطلاعات بانکی پرسنل.xlsx");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost("set-default/{bankId:long}")]
|
||||||
|
public IActionResult SetDefault(long bankId)
|
||||||
|
{
|
||||||
|
var result = _employeeBankInformationApplication.SetDefault(_workshopId, bankId);
|
||||||
|
return new JsonResult(new
|
||||||
|
{
|
||||||
|
success = result.IsSuccedded,
|
||||||
|
message = result.Message,
|
||||||
|
id = result.SendId
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public class DownloadExcelRequest
|
public class DownloadExcelRequest
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user