示例#1
0
        public void LoanIntegration_Delete_ShouldBeOk()
        {
            _loan.Id = 1;

            _service.Delete(_loan);
            _expectedLoan = _service.Get(_loan);

            _expectedLoan.Should().BeNull();
        }
示例#2
0
        public void LoanService_Delete_ShouldBeOk()
        {
            _book.Object.Id           = 1;
            _book.Object.Availability = true;
            _loan = ObjectMother.GetLoan(_book.Object);
            _repository.Setup(rp => rp.Delete(_loan.Id));
            _repository.Setup(rp => rp.Get(_loan.Id));

            _service.Delete(_loan);
            _expectedLoan = _service.Get(_loan);

            _expectedLoan.Should().BeNull();
            _repository.Verify(rp => rp.Delete(_loan.Id));
        }
示例#3
0
        public async Task <IActionResult> DeleteConfirmed(int?id)
        {
            var bookLoan = context.GetBookLoanById(id.GetValueOrDefault());

            context.Delete(bookLoan);
            return(RedirectToAction(nameof(Index)));
        }
示例#4
0
        public void LoanSqlRepository_Delete_ShouldBeOk()
        {
            //Cenário
            int  idSearch = 1;
            Loan loan     = _service.Get(idSearch);

            loan.Book.Disponibility = true;

            //Executa
            _service.Delete(loan);

            //Saída
            Loan result = _service.Get(idSearch);

            result.Should().BeNull();
        }
        public IActionResult Delete(int id)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            try
            {
                Loan ObjLoan = _loanService.Get(id);
                _loanService.Delete(ObjLoan);

                sb.Append("Sumitted");
                return(Content(sb.ToString()));
            }
            catch (Exception ex)
            {
                sb.Append("Error :" + ex.Message);
            }

            return(Content(sb.ToString()));
        }
示例#6
0
 private void BTNExcluir_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(TBXCodigo.Text))
     {
         MessageBox.Show("Selecione uma locação para remover");
     }
     else
     {
         try
         {
             LoanService = new LoanService();
             var loanCode = Convert.ToInt32(TBXCodigo.Text);
             LoanService.Delete(loanCode);
         }catch (Exception ex) {
             MessageBox.Show("Não pode ser excluída esta locação, pois ela está relacionado com outros dados");
             Console.WriteLine(ex.Message);
         }
     }
 }
示例#7
0
        public async Task <Loan> DeleteLoan(Loan loan)
        {
            await _loanService.Delete(loan);

            return(loan);
        }
示例#8
0
 public IHttpActionResult DelteLoan(int id)
 {
     _loanService.Delete(id);
     return(Ok());
 }
示例#9
0
        public IActionResult Delete(string id)
        {
            _loanService.Delete(id);

            return(RedirectToAction("Index"));
        }
示例#10
0
 public IActionResult DeleteConfirmed(int id)
 {
     _loanService.Delete(id);
     return(RedirectToAction(nameof(Index)));
 }