Add exception handling for unsuccessful institution contract creation

This commit is contained in:
MahanCh
2025-09-13 13:15:32 +03:30
parent 6a982a80f7
commit 116f40d87d

View File

@@ -1,6 +1,7 @@
using System.Transactions;
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using _0_Framework.Exceptions;
using AccountManagement.Application.Contracts.Account;
using CompanyManagement.Infrastructure.Excel.InstitutionContract;
using CompanyManagment.App.Contracts.Employer;
@@ -655,6 +656,10 @@ public class institutionContractController : AdminBaseController
public async Task<ActionResult<OperationResult>> Create([FromBody]CreateInstitutionContractRequest command)
{
var res =await _institutionContractApplication.CreateAsync(command);
if(!res.IsSuccedded)
throw new BadRequestException(res.Message);
return res;
}