public static BannedIP Load(Int32 bannedIPId, bool useCache) { if (bannedIPId == 0) { return(null); } BannedIP bannedIP = null; string key = "BannedIP_" + bannedIPId.ToString(); if (useCache) { bannedIP = ContextCache.GetObject(key) as BannedIP; if (bannedIP != null) { return(bannedIP); } } bannedIP = new BannedIP(); if (bannedIP.Load(bannedIPId)) { if (useCache) { ContextCache.SetObject(key, bannedIP); } return(bannedIP); } return(null); }
public static bool Delete(Int32 bannedIPId) { BannedIP bannedIP = new BannedIP(); if (bannedIP.Load(bannedIPId)) { return(bannedIP.Delete()); } return(false); }