コード例 #1
0
        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));
        }
コード例 #2
0
        public Income GetById(int IncomeId)
        {
            var Income = IncomeRepository.GetById(IncomeId);

            if (Income == null)
            {
                throw new BadRequestException(ErrorMessages.GastoNoEncontrado);
            }

            return(Income);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: IncomeService.cs プロジェクト: qchouleur/MyHome
 public Income LoadById(int id)
 {
     return(_repository.GetById(id));
 }
コード例 #5
0
        public void DeleteIncome(int IncomeId)
        {
            var Income = IncomeRepository.GetById(IncomeId);

            IncomeRepository.Delete(Income);
        }