public IEnumerable <Method> GetAllMethods() { using (var context = new BudgetDataContext(_connectionstring)) { return(context.Methods.ToList()); } }
//public IEnumerable<Expense> FilterByAmount(int amount) //{ // IEnumerable<Expense> //} public IEnumerable <Store> GetAllStores() { using (var context = new BudgetDataContext(_connectionstring)) { return(context.Stores.ToList()); } }
public void AddMethod(Method method) { using (var context = new BudgetDataContext(_connectionstring)) { context.Methods.InsertOnSubmit(method); context.SubmitChanges(); } }
public void AddStore(Store store) { using (var context = new BudgetDataContext(_connectionstring)) { context.Stores.InsertOnSubmit(store); context.SubmitChanges(); } }
public void AddExpenes(Expense expense) { using (var context = new BudgetDataContext(_connectionstring)) { context.Expenses.InsertOnSubmit(expense); context.SubmitChanges(); } }
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()); } }