Пример #1
0
        public async Task <IActionResult> AddDebt([FromBody] DebtDto debtToAdd)
        {
            if (debtToAdd.DebtStatusName == null)
            {
                return(BadRequest("The status is mandatory!"));
            }

            if (debtToAdd.LoanAmount == 0)
            {
                return(BadRequest("The amount is mandatory!"));
            }

            var result = await _debtService.AddDebt(debtToAdd);

            if (!result.Succeeded)
            {
                return(BadRequest(result));
            }

            return(Ok(result));
        }
 public async Task <IActionResult> Add(Debt newDebt)
 {
     return(Ok(await _debtService.AddDebt(newDebt)));
 }