public ServiceResponse <IList <IncomeFormDTO> > GetById(long idUser, long idIncome) { var income = _incomeRepository.GetById(idUser, idIncome); var incomeDTO = _mapper.Map <IList <IncomeFormDTO> >(income); return(ServiceResponse <IList <IncomeFormDTO> > .SetSuccess(incomeDTO)); }
public Income GetById(int IncomeId) { var Income = IncomeRepository.GetById(IncomeId); if (Income == null) { throw new BadRequestException(ErrorMessages.GastoNoEncontrado); } return(Income); }
private void Credit(Account account, Account internalAccount, Movement movement) { MovementHelpers.Credit(HistoricMovementRepository, movement.Amount, account.Id, ObjectType.Account, account.CurrentBalance, internalAccount.Id, ObjectType.Account, internalAccount.CurrentBalance); account.CurrentBalance += movement.Amount; BankAccountRepository.Update(account); internalAccount.CurrentBalance -= movement.Amount; BankAccountRepository.Update(internalAccount); if (!movement.TargetIncomeId.HasValue) { throw new ArgumentException("Target Income ID should not be null."); } var income = IncomeRepository.GetById(movement.TargetIncomeId.Value); IncomeRepository.Delete(income); }
public Income LoadById(int id) { return(_repository.GetById(id)); }
public void DeleteIncome(int IncomeId) { var Income = IncomeRepository.GetById(IncomeId); IncomeRepository.Delete(Income); }