//Get the data for a particular expense public UserExpenses GetExpenseData(int id) { try { UserExpenses expense = db.UserExpenses.Find(id); return(expense); } catch { throw; } }
//To Add new Expense record public void AddExpense(UserExpenses expense) { try { db.UserExpenses.Add(expense); db.SaveChanges(); } catch (Exception ex) { throw; } }
//To Delete the record of a particular expense public void DeleteExpense(int id) { try { UserExpenses emp = db.UserExpenses.Find(id); db.UserExpenses.Remove(emp); db.SaveChanges(); } catch { throw; } }
//To Update the records of a particluar expense public int UpdateExpense(UserExpenses expense) { try { db.Entry(expense).State = EntityState.Modified; db.SaveChanges(); return(1); } catch { throw; } }