예제 #1
0
 public IEnumerable <Method> GetAllMethods()
 {
     using (var context = new BudgetDataContext(_connectionstring))
     {
         return(context.Methods.ToList());
     }
 }
예제 #2
0
        //public IEnumerable<Expense> FilterByAmount(int amount)
        //{
        //    IEnumerable<Expense>

        //}
        public IEnumerable <Store> GetAllStores()
        {
            using (var context = new BudgetDataContext(_connectionstring))
            {
                return(context.Stores.ToList());
            }
        }
예제 #3
0
 public void AddMethod(Method method)
 {
     using (var context = new BudgetDataContext(_connectionstring))
     {
         context.Methods.InsertOnSubmit(method);
         context.SubmitChanges();
     }
 }
예제 #4
0
 public void AddStore(Store store)
 {
     using (var context = new BudgetDataContext(_connectionstring))
     {
         context.Stores.InsertOnSubmit(store);
         context.SubmitChanges();
     }
 }
예제 #5
0
 public void AddExpenes(Expense expense)
 {
     using (var context = new BudgetDataContext(_connectionstring))
     {
         context.Expenses.InsertOnSubmit(expense);
         context.SubmitChanges();
     }
 }
예제 #6
0
 public IEnumerable <Expense> GetAllExpenses()
 {
     using (var context = new BudgetDataContext(_connectionstring))
     {
         var loadOptions = new DataLoadOptions();
         loadOptions.LoadWith <Expense>(e => e.Store);
         loadOptions.LoadWith <Expense>(e => e.Method);
         context.LoadOptions = loadOptions;
         return(context.Expenses.ToList());
     }
 }