feat: add methods for creating, calculating installments, and removing loans in LoanController

This commit is contained in:
2026-01-01 14:41:13 +03:30
parent 9cfae54db3
commit 4ab9f60932

View File

@@ -1,3 +1,4 @@
using _0_Framework.Application;
using CompanyManagment.App.Contracts.Loan;
using Microsoft.AspNetCore.Mvc;
using ServiceHost.BaseControllers;
@@ -25,5 +26,30 @@ public class LoanController: ClientBaseController
var loan = await _loanApplication.GetDetails(id);
return loan;
}
[HttpPost]
public ActionResult<OperationResult> Create([FromBody] CreateLoanViewModel command)
{
var result = _loanApplication.Create(command);
return result;
}
[HttpGet("create/installments")]
public ActionResult<List<LoanInstallmentViewModel>> CalculateLoanInstallment(string amount,
int installmentCount, string loanStartDate, bool getRounded)
{
var installments =
_loanApplication.CalculateLoanInstallment(amount, installmentCount, loanStartDate, getRounded);
return installments;
}
[HttpDelete("{id}")]
public ActionResult<OperationResult> Remove(long id)
{
var result = _loanApplication.Remove(id);
return result;
}
}