Exemple #1
0
        public static void SaveNewsInDatabase(this News news, Repository <News> _repo)
        {
            var conf = Conf.Get <bool>("Hazf");

            if (conf)
            {
                var all = _repo.FindAll(x => x.PublishDate > news.PublishDate.AddHours(-8));
                if (all.AsParallel().None(x => StringCompare.IsPotentiallySimilar(x, news)))
                {
                    _repo.Add(news);
                }
                else
                {
                }
            }
            else
            {
                _repo.Add(news);
            }
        }