public void AddUser(User user) { using (ContextDBDataContext context = new ContextDBDataContext(_connectionString)) { context.Users.InsertOnSubmit(user); context.SubmitChanges(); } }
public void AddCredit(Credit credit) { using (ContextDBDataContext context = new ContextDBDataContext(_connectionString)) { context.Credits.InsertOnSubmit(credit); context.SubmitChanges(); } }
public List <Debit> AddDebit(Debit debit) { using (ContextDBDataContext context = new ContextDBDataContext(_connectionString)) { context.Debits.InsertOnSubmit(debit); context.SubmitChanges(); return(GetDebitsByMonthId(debit.UserId, debit.MonthId)); } }
// adds new month and returns false if month already exists public bool AddMonth(Month_Year NewMonth) { using (ContextDBDataContext context = new ContextDBDataContext(_connectionString)) { if (DoesMonthExistForUser(context.Month_Years.Where(M => M.UserId == NewMonth.UserId).ToList(), NewMonth)) { return(true); } context.Month_Years.InsertOnSubmit(NewMonth); context.SubmitChanges(); return(false); } }