public virtual Counter GetCounter() { var ipAddress = ClientInfoHelper.GetHostIp(); var counterList = _commonDataAccess.GetCounterByIp(ipAddress); if (counterList == null) { return(null); } if (counterList.Count == 0) { ipAddress = ClientInfoHelper.GetHostName(); counterList = _commonDataAccess.GetCounterByIp(ipAddress); } if (counterList.Count == 0) { return(null); } return(counterList[0] as Counter); }