public void DeleteExpense(ExpenseDetail expense) { var expenseDb = ConvertToDb(expense); _context.ExpenseDetails.Remove(expenseDb); _context.SaveChanges(); }
public void UpdateExpense(ExpenseDetail expenseToUpdate) { var expenseDb = ConvertToDb(expenseToUpdate); _context.ExpenseDetails.Update(expenseDb); _context.SaveChanges(); }
public void AddExpense(ExpenseDetail expense) { var expenseModel = ConvertToDb(expense); _context.ExpenseDetails.Add(expenseModel); _context.SaveChanges(); }
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; }
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 }); }
public void AddNewExpense(ExpenseDetail newExpense) { _expenseStorage.AddExpense(newExpense); }
public void DeleteExpense(ExpenseDetail expense) { _expenseList.Remove(expense); Console.WriteLine("The expense deleted!!!"); }
public void UpdateExpense(ExpenseDetail expense, double amount) { expense.Amount = amount; Console.WriteLine("Updated amount in expense!!!"); }
public void AddExpense(ExpenseDetail expense) { _expenseList.Add(expense); Console.WriteLine("Expense has been added sucessfully!!!"); }
public void DeleteExpense(ExpenseDetail expense) { _expenseList.Remove(expense); }
public void AddExpense(ExpenseDetail expense) { _expenseList.Add(expense); }
public void UpdateEachExpense(ExpenseDetail expenseToUpdate) { _expenseStorage.UpdateExpense(expenseToUpdate); }