Example #1
0
 //Get the data for a particular expense
 public UserExpenses GetExpenseData(int id)
 {
     try
     {
         UserExpenses expense = db.UserExpenses.Find(id);
         return(expense);
     }
     catch
     {
         throw;
     }
 }
Example #2
0
 //To Add new Expense record
 public void AddExpense(UserExpenses expense)
 {
     try
     {
         db.UserExpenses.Add(expense);
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Example #3
0
 //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;
     }
 }
Example #4
0
 //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;
     }
 }