public async Task <IActionResult> DeleteBankAccount(int idBankAccount) { if (await _bankAccountRepository.Delete(idBankAccount)) { return(Ok()); } return(BadRequest()); }
public void Delete(Guid id) { var entity = _bankAccountRepository.GetById(id); if (entity == null) { return; } _bankAccountRepository.Delete(entity); }
public ActionResult DeleteConfirmed(int id) { var bankAccountVm = new BankAccountViewModel { BankAccount = _bankAccountRepository.GetWhere(x => x.Id == id).FirstOrDefault() }; _bankAccountRepository.Delete(bankAccountVm.BankAccount); return(RedirectToAction("Index")); }
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); }
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)); } }
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"); }
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); }
public async Task <int> Delete(int id) { return(await _bankAccountRepository.Delete(id)); }
public IActionResult Delete(long Id) { repository.Delete(Id); return(RedirectToAction("All")); }
public BankAccount DeleteAcc(int id) { return(_repo.Delete(id)); }
public void DeleteBankAccount(BankAccount bankAccount) { _bankAccountRepository.Delete(bankAccount); }
public void Delete(Bank_Account bank_Account) { bankAccountRepository.Delete(bank_Account); }
public bool Delete(Guid id) { var result = bankAccountRepository.Delete(id); return(result); }
public void DeleteBankAccount(int id) { var account = _bankAccountRepository.GetById(id); _bankAccountRepository.Delete(account); }
public IActionResult Delete(int bankAccountID) { _repository.Delete(bankAccountID); return(RedirectToAction("List")); }