Ejemplo n.º 1
0
        public async Task <bool> CheckIfActionCanBePerformed()
        {
            var ip       = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()).AddressList[1].ToString();
            var repoLogs = await _uerLogRepository.GetByIP(ip);

            var logsCount = repoLogs.Where(x => x.Type == TaskType.SearchAnagram || x.Type == TaskType.DeleteWord).ToList().Count -
                            repoLogs.Where(x => x.Type == TaskType.UpdateWord || x.Type == TaskType.CreateWord).ToList().Count;

            var maxSearchCount = Settings.MaxSearchCount;

            if (maxSearchCount > logsCount)
            {
                return(true);
            }
            return(false);
        }