public void Remove(int id) { var expense = _context.Expenses.Find(id); _context.Expenses.Remove(expense); _context.SaveChanges(); }
public void Remove(int id) { var expense = _context.Expenses.FirstOrDefault(e => e.Id == id); _context.Expenses.Remove(expense); _context.SaveChanges(); }
public void Remove(int id) { var income = _context.Incomes.Find(id); _context.Incomes.Remove(income); _context.SaveChanges(); }
public void Remove(int id) { var income = _context.Incomes.FirstOrDefault(i => i.Id == id); _context.Incomes.Remove(income); _context.SaveChanges(); }
public void Update(PaymentMethod paymentMethod) { var dbCat = _context.PaymentMethods.FirstOrDefault(ec => ec.Id == paymentMethod.Id); if (dbCat != null) { dbCat.Name = paymentMethod.Name; } _context.SaveChanges(); }
public void Update(IncomeCategory incomeCategory) { var dbCat = _context.IncomeCategories.FirstOrDefault(ec => ec.Id == incomeCategory.Id); if (dbCat != null) { dbCat.Name = incomeCategory.Name; } _context.SaveChanges(); }
public void Update(ExpenseCategory expenseCategory) { var dbCat = _context.ExpenseCategories.FirstOrDefault(ec => ec.Id == expenseCategory.Id); if (dbCat != null) { dbCat.Name = expenseCategory.Name; } _context.SaveChanges(); }
public void Update(IncomeCategory incomeCategory) { _context.IncomeCategories.Attach(incomeCategory); _context.SaveChanges(); }
public void Update(PaymentMethod paymentMethod) { _context.PaymentMethods.Attach(paymentMethod); _context.SaveChanges(); }
public void Update(ExpenseCategory expenseCategory) { _context.ExpenseCategories.Attach(expenseCategory); _context.SaveChanges(); }