Beispiel #1
0
        public async Task <ExpenseDto> GetAsync(Guid settlementId, Guid userId, Guid expenseId, Guid currentUserId)
        {
            var userExpenses = await _settlementRepository.GetExpensesOrFailAsync(settlementId, userId, currentUserId);

            var expense = userExpenses.SingleOrDefault(x => x.Id == expenseId);

            if (userExpenses == null)
            {
                throw new Exception($"Expense with id: '{expenseId}' does not exist.");
            }
            return(_mapper.Map <ExpenseDto>(expense));
        }