コード例 #1
0
ファイル: Expense.cs プロジェクト: DionisRaci/BillShare
 public void copyProperties(IExpense other)
 {
     other.CheckArgument(nameof(other));
     BillID      = other.BillID;
     Designation = other.Designation;
     Amount      = other.Amount;
     Friend      = other.Friend;
 }
コード例 #2
0
        public void Add(IExpense expense)
        {
            expense.CheckArgument(nameof(expense));

            var entity = new Expense();

            entity.CopyProperties(expense);
            ExpenseEntities.Add(entity);
        }
コード例 #3
0
        public void Add(IExpense expense)
        {
            expense.CheckArgument(nameof(expense));

            var newItem = new Expense();

            newItem.CopyProperties(expense);
            ExpenseEntities.Add(newItem);
        }
コード例 #4
0
 public void CopyProperties(IExpense other)
 {
     other.CheckArgument(nameof(other));
     Id          = other.Id;
     TravelId    = other.TravelId;
     Date        = other.Date;
     Description = other.Description;
     Amount      = other.Amount;
     Friend      = other.Friend;
 }
コード例 #5
0
 public void CopyProperties(IExpense other)
 {
     other.CheckArgument(nameof(other));
     id          = other.id;
     Date        = other.Date;
     Title       = other.Title;
     Description = other.Description;
     Currency    = other.Currency;
     Friends     = other.Friends;
 }
コード例 #6
0
        public void Remove(IExpense expense)
        {
            expense.CheckArgument(nameof(expense));

            var entity = ExpenseEntities.FirstOrDefault(i => (i.Id != 0 && i.Id == expense.Id) ||
                                                        (i.Id == 0 && i.Designation != null && i.Designation.Equals(expense.Designation)));

            if (entity != null)
            {
                ExpenseEntities.Remove(entity);
            }
        }
コード例 #7
0
        public void Remove(IExpense expense)
        {
            expense.CheckArgument(nameof(expense));

            foreach (var item in ExpenseEntities)
            {
                if (item.Id != 0 && item.Id == expense.Id)
                {
                    ExpenseEntities.Remove(item);
                }
                else if (item.Designation != null && item.Designation.Equals(expense.Designation))
                {
                    ExpenseEntities.Remove(item);
                }
            }
        }