Exemplo n.º 1
0
        partial void BeforeCopyProperties(IBillExpense other, ref bool handled)
        {
            other.CheckArgument(nameof(other));
            other.Bill.CheckArgument(nameof(other.Bill));
            other.Expenses.CheckArgument(nameof(other.Expenses));
            other.Balances.CheckArgument(nameof(other.Balances));

            handled         = true;
            TotalExpense    = other.TotalExpense;
            FriendPortion   = other.FriendPortion;
            NumberOfFriends = other.NumberOfFriends;
            Friends         = other.Friends;
            FriendAmounts   = other.FriendAmounts;
            BilllEntity.CopyProperties(other.Bill);
            ExpenseEntities.Clear();
            foreach (var item in other.Expenses)
            {
                var expense = new Expense();

                expense.CopyProperties(item);
                ExpenseEntities.Add(expense);
            }
            BalanceEntities.Clear();
            foreach (var item in other.Balances)
            {
                var balance = new Balance();

                balance.CopyProperties(item);
                BalanceEntities.Add(balance);
            }
        }
Exemplo n.º 2
0
        public void Add(IExpense expense)
        {
            expense.CheckArgument(nameof(expense));

            var entity = new Expense();

            entity.CopyProperties(expense);
            ExpenseEntities.Add(entity);
        }
Exemplo n.º 3
0
        public void Add(IExpense expense)
        {
            expense.CheckArgument(nameof(expense));

            var newItem = new Expense();

            newItem.CopyProperties(expense);
            ExpenseEntities.Add(newItem);
        }
Exemplo n.º 4
0
        public void CopyProperties(IBillExpense other)
        {
            other.CheckArgument(nameof(other));
            other.Bill.CheckArgument(nameof(other.Bill));
            other.Expenses.CheckArgument(nameof(other.Expenses));

            BillEntity.CopyProperties(other.Bill);
            ExpenseEntities.Clear();
            foreach (var item in other.Expenses)
            {
                var expense = new Expense();

                expense.CopyProperties(item);
                ExpenseEntities.Add(expense);
            }
        }
Exemplo n.º 5
0
        partial void BeforeCopyProperties(IBillExpense other, ref bool handled)
        {
            other.CheckArgument(nameof(other));
            other.Bill.CheckArgument(nameof(other.Bill));
            other.Expenses.CheckArgument(nameof(other.Expenses));

            handled = true;
            BillEntity.CopyProperties(other.Bill);
            ExpenseEntities.Clear();
            foreach (var item in other.Expenses)
            {
                var expense = new Expense();

                expense.CopyProperties(item);
                ExpenseEntities.Add(expense);
            }
        }
        public async Task <ITravelExpense> InsertAsync(ITravelExpense entity)
        {
            entity.CheckArgument(nameof(entity));
            entity.Travel.CheckArgument(nameof(entity.Travel));
            entity.Expenses.CheckArgument(nameof(entity.Expenses));

            var result = new TravelExpense();

            result.TravelEntity.CopyProperties(entity.Travel);
            foreach (var item in entity.Expenses)
            {
                var expense = new Expense();

                expense.Travel = result.TravelEntity;
                expense.CopyProperties(item);
                await expenseController.InsertAsync(expense);

                result.ExpenseEntities.Add(expense);
            }
            return(result);
        }