public static AccountDbContext getInstance() { if (accountDbContext == null) { accountDbContext = new AccountDbContext(); } return(accountDbContext); }
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); } }