コード例 #1
0
        public async Task <IActionResult> DeleteBankAccount(int idBankAccount)
        {
            if (await _bankAccountRepository.Delete(idBankAccount))
            {
                return(Ok());
            }

            return(BadRequest());
        }
コード例 #2
0
        public void Delete(Guid id)
        {
            var entity = _bankAccountRepository.GetById(id);

            if (entity == null)
            {
                return;
            }
            _bankAccountRepository.Delete(entity);
        }
コード例 #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            var bankAccountVm = new BankAccountViewModel
            {
                BankAccount = _bankAccountRepository.GetWhere(x => x.Id == id).FirstOrDefault()
            };

            _bankAccountRepository.Delete(bankAccountVm.BankAccount);
            return(RedirectToAction("Index"));
        }
コード例 #4
0
        public void Remove(BankAccount account)
        {
            if (account is null)
            {
                throw new ArgumentNullException(nameof(account));
            }

            if (!IsExist(account))
            {
                throw new RequestForExistAccountException($"{nameof(account)} not found");
            }

            bankAccountRepository.Delete(account.Id);
        }
コード例 #5
0
 public ActionResult <BankAccount> Delete(
     [FromServices] IBankAccountRepository repository, int id)
 {
     try
     {
         BankAccount ca = repository.Get().AsNoTracking().FirstOrDefault(x => x.Id == id);
         if (User == null)
         {
             return(NotFound(new { message = "Conta inválida" }));
         }
         repository.Delete(ca);
         return(Ok(new { message = "Conta excluida" }));
     }
     catch (Exception ex)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, ex));
     }
 }
コード例 #6
0
        public async Task DeleteBankAccount(DeleteUserBankAccountDTO dto)
        {
            var bankAccount = await _bankAccountRepository.GetById(dto.BankAccountId);

            Validate.NotNull(bankAccount, "Bank account not found");
            Validate.IsTrue(bankAccount.UserId == dto.UserId, "Acesso negado");

            // TODO: check if bankAccount have Transactions
            //var transactions = await _transactionRepository.GetByBankAccount(dto.BankAccountId);

            // TODO: UnitOfWork
            //if(transactions.Count() > 0)
            //{
            //    await _transactionRepository.DeleteRange(transactions);
            //}

            _bankAccountRepository.Delete(bankAccount);
            Validate.IsTrue(await _uow.CommitAsync(), "Não foi possível remover a conta bancária");
        }
コード例 #7
0
        public void TestCRUD()
        {
            Core.Entities.BankAccount read;
            var entity = testEntity;// new Core.Entities.BankAccount() { Name = "TestCRUD-" + Guid.NewGuid().ToString() };

            repository.Add(entity);
            Assert.IsTrue(entity.BankAccountId > 0, "BankAccountId not set");

            read = repository.Read(entity.BankAccountId);
            Assert.IsNotNull(read);
            CompareBankAccounts(entity, read, "Read");

            entity.Name += "-UPDATE";
            repository.Update(entity);
            read = repository.Read(entity.BankAccountId);
            Assert.IsNotNull(read);
            CompareBankAccounts(entity, read, "Update");

            repository.Delete(entity);

            read = repository.Read(entity.BankAccountId);
            Assert.IsNull(read);
        }
コード例 #8
0
 public async Task <int> Delete(int id)
 {
     return(await _bankAccountRepository.Delete(id));
 }
コード例 #9
0
 public IActionResult Delete(long Id)
 {
     repository.Delete(Id);
     return(RedirectToAction("All"));
 }
コード例 #10
0
 public BankAccount DeleteAcc(int id)
 {
     return(_repo.Delete(id));
 }
コード例 #11
0
 public void DeleteBankAccount(BankAccount bankAccount)
 {
     _bankAccountRepository.Delete(bankAccount);
 }
コード例 #12
0
ファイル: BankAccountService.cs プロジェクト: tiennh-dev/ACC
 public void Delete(Bank_Account bank_Account)
 {
     bankAccountRepository.Delete(bank_Account);
 }
コード例 #13
0
        public bool Delete(Guid id)
        {
            var result = bankAccountRepository.Delete(id);

            return(result);
        }
コード例 #14
0
        public void DeleteBankAccount(int id)
        {
            var account = _bankAccountRepository.GetById(id);

            _bankAccountRepository.Delete(account);
        }
コード例 #15
0
 public IActionResult Delete(int bankAccountID)
 {
     _repository.Delete(bankAccountID);
     return(RedirectToAction("List"));
 }