コード例 #1
0
        public void DeleteExpense(ExpenseDetail expense)
        {
            var expenseDb = ConvertToDb(expense);

            _context.ExpenseDetails.Remove(expenseDb);
            _context.SaveChanges();
        }
コード例 #2
0
        public void UpdateExpense(ExpenseDetail expenseToUpdate)
        {
            var expenseDb = ConvertToDb(expenseToUpdate);

            _context.ExpenseDetails.Update(expenseDb);
            _context.SaveChanges();
        }
コード例 #3
0
        public void AddExpense(ExpenseDetail expense)
        {
            var expenseModel = ConvertToDb(expense);

            _context.ExpenseDetails.Add(expenseModel);
            _context.SaveChanges();
        }
コード例 #4
0
        public void UpdateExpense(ExpenseDetail expenseToUpdate)
        {
            ExpenseDetail expense = GetById(expenseToUpdate.ItemId);

            expense.StoreName   = expenseToUpdate.StoreName;
            expense.ItemName    = expenseToUpdate.ItemName;
            expense.Amount      = expenseToUpdate.Amount;
            expense.ExpenseDate = expenseToUpdate.ExpenseDate;
            expense.Category    = expenseToUpdate.Category;
        }
コード例 #5
0
 public static ExpenseDetailEF ConvertToDb(ExpenseDetail expense)
 {
     return(new ExpenseDetailEF()
     {
         ExpenseDetailEFId = expense.ItemId,
         StoreName = expense.StoreName,
         ItemName = expense.ItemName,
         Amount = expense.Amount,
         ExpenseDate = expense.ExpenseDate,
         Category = expense.Category
     });
 }
コード例 #6
0
 public void AddNewExpense(ExpenseDetail newExpense)
 {
     _expenseStorage.AddExpense(newExpense);
 }
コード例 #7
0
 public void DeleteExpense(ExpenseDetail expense)
 {
     _expenseList.Remove(expense);
     Console.WriteLine("The expense deleted!!!");
 }
コード例 #8
0
 public void UpdateExpense(ExpenseDetail expense, double amount)
 {
     expense.Amount = amount;
     Console.WriteLine("Updated amount in expense!!!");
 }
コード例 #9
0
 public void AddExpense(ExpenseDetail expense)
 {
     _expenseList.Add(expense);
     Console.WriteLine("Expense has been added sucessfully!!!");
 }
コード例 #10
0
 public void DeleteExpense(ExpenseDetail expense)
 {
     _expenseList.Remove(expense);
 }
コード例 #11
0
 public void AddExpense(ExpenseDetail expense)
 {
     _expenseList.Add(expense);
 }
コード例 #12
0
 public void UpdateEachExpense(ExpenseDetail expenseToUpdate)
 {
     _expenseStorage.UpdateExpense(expenseToUpdate);
 }