Exemplo n.º 1
0
 public static void CreateExpense(string databaseConnectionString, Model.Expense expense)
 {
     using (var db = new ExpensesDataContext(databaseConnectionString))
     {
         db.Expenses.InsertOnSubmit(expense.ToEntity());
         db.SubmitChanges();
     }
 }
Exemplo n.º 2
0
 public static void BypassRepositoryAndDeleteExpense(string databaseConnectionString, Guid guid)
 {
     using (var db = new ExpensesDataContext(databaseConnectionString))
     {
         DataAccessLayer.Expense expense = db.Expenses.Where(e => e.Id == guid).ToList().FirstOrDefault();
         db.Expenses.DeleteOnSubmit(expense);
         db.SubmitChanges();
     }
 }
Exemplo n.º 3
0
        internal static void DeleteExpenseInDB(string TestDatabaseConnectionString, Guid testGuid)
        {
            using (var db = new ExpensesDataContext(TestDatabaseConnectionString))
            {
                var expDetails = db.ExpenseDetails.Where(e => e.ExpenseId == testGuid);
                db.ExpenseDetails.DeleteAllOnSubmit(expDetails);

                var exp = db.Expenses.Where(e => e.Id == testGuid);
                db.Expenses.DeleteAllOnSubmit(exp);
                db.SubmitChanges();
            }
        }