예제 #1
0
        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();
        }
예제 #2
0
 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);
 }
예제 #4
0
        public async Task <Unit> Handle(DeleteLoanCommand request, CancellationToken cancellationToken)
        {
            Loan loan = await _repository.GetSingle(request.LoanId);

            await _repository.Delete(loan);

            return(Unit.Value);
        }
예제 #5
0
        public void LoanRepository_Delete_ShouldBeOk()
        {
            _loan.Id = 1;

            _repository.Delete(_loan.Id);
            _expectedLoan = _repository.Get(_loan.Id);

            _expectedLoan.Should().BeNull();
        }
예제 #6
0
파일: LoanService.cs 프로젝트: nmotocic/LMS
        //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);
        }
예제 #7
0
        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));
        }
예제 #8
0
 public void Delete(Loan loan)
 {
     _clientService.Delete(loan.Client);
     _loanRepository.Delete(loan);
 }
예제 #9
0
 public void Delete(int code)
 {
     LoanRepository.Delete(code);
 }
예제 #10
0
 public Task <int?> DeleteLoan(int id)
 {
     return(_loanRepository.Delete(id));
 }
예제 #11
0
 public IActionResult Delete(int id)
 {
     db.Delete(id);
     return(RedirectToAction("Index"));
 }