public IEnumerable <LogHistoryModel> GetByDeptId(int deptCode) { try { var list = (from l in _db.SP_SYS_GET_LOG_BY_DEPTID(deptCode) select new LogHistoryModel() { UserId = l.UserId, IpAddress = l.IpAddress, LogTime = l.LogTime, DeptName = l.DeptName, PlantName = l.PlantName, OrganizeName = l.OrganizationName, SectionName = l.SectName, Name = l.LocalName }).ToList(); if (list.Count == 0) { return(null); } foreach (var item in list) { item.StringIpAddress = Util.INT2IP(item.IpAddress ?? 0); } return(list); } catch (Exception ex) { LogHelper.Error("NoticesRepository GetNotices: " + ex.Message + " Inner Exception: " + ex.InnerException.Message); return(null); } }