feat: add methods for creating, calculating installments, and removing loans in LoanController
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user