public void LoanSqlRepository_Delete_ShouldBeOk() { //Cenário int idSearch = 1; Loan loan = _repository.Get(idSearch); //Executa _repository.Delete(loan); //Saída Loan result = _repository.Get(idSearch); result.Should().BeNull(); }
public void Delete(Loan loan) { if (loan.Id == 0) { throw new InvalidIdException(); } _repository.Delete(loan.Id); }
public void Delete(Loan loan) { if (loan.Id <= 0) { throw new IdentifierUndefinedException(); } _loanRepository.Delete(loan); }
public async Task <Unit> Handle(DeleteLoanCommand request, CancellationToken cancellationToken) { Loan loan = await _repository.GetSingle(request.LoanId); await _repository.Delete(loan); return(Unit.Value); }
public void LoanRepository_Delete_ShouldBeOk() { _loan.Id = 1; _repository.Delete(_loan.Id); _expectedLoan = _repository.Get(_loan.Id); _expectedLoan.Should().BeNull(); }
//Check in the book public bool CheckInBook(int bookId) { var book = _bookRepository.GetByID(bookId); var list = _loanRepository.GetAll().Loans; var loan = _loanRepository.GetByBookId(bookId); if (loan == null) { return(false); } UpdateBookStatus(bookId, "Avaliable"); _bookRepository.Update(bookId); _loanRepository.Delete(loan); return(true); }
public async Task <ActionResult <Loan> > DeleteLoan(int id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var loan = await _context.Loans.FindAsync(id); if (loan == null) { return(NotFound()); } _loanRepository.Delete(loan); var save = await _loanRepository.SaveAsync(loan); return(Ok(loan)); }
public void Delete(Loan loan) { _clientService.Delete(loan.Client); _loanRepository.Delete(loan); }
public void Delete(int code) { LoanRepository.Delete(code); }
public Task <int?> DeleteLoan(int id) { return(_loanRepository.Delete(id)); }
public IActionResult Delete(int id) { db.Delete(id); return(RedirectToAction("Index")); }