Пример #1
0
        public void DeleteLoanTest()
        {
            int maxID    = _loans.Max(a => a.Id); // Before removal
            var lastLoan = _loans.Last();

            // Remove last Loan
            _loanService.DeleteLoan(lastLoan.Id);
            Assert.That(maxID, Is.GreaterThan(_loans.Max(a => a.Id)));
        }
        public async Task <ActionResult <Result> > DeleteCurrency(long loanId)
        {
            var result = await _loanService.DeleteLoan(new LoanDto { Id = loanId });

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

            return(Ok(result));
        }
Пример #3
0
        public async Task <IActionResult> RemoveLoanById([FromRoute] Guid id)
        {
            try
            {
                var response = await _service.DeleteLoan(id);

                return(Json(response.Object));
            }
            catch (Exception ex)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError, ex.Message));
            }
        }
 public async Task <IActionResult> Delete([FromRoute] int id)
 {
     return(HandleResponse(await _loanService.DeleteLoan(id)));
 }