Beispiel #1
0
 public static AccountDbContext getInstance()
 {
     if (accountDbContext == null)
     {
         accountDbContext = new AccountDbContext();
     }
     return(accountDbContext);
 }
Beispiel #2
0
        public string delete(AccountGroup item)
        {
            var accounts = AccountDbContext.getInstance().findAccountsByAccountGroup(item);

            if (accounts.Count > 0)
            {
                return("Cannot delete account group which exists account(s).");
            }

            using (var db = new BaseDbContext())
            {
                db.Entry(item).State = EntityState.Deleted;
                db.SaveChanges();
                return(null);
            }
        }