Пример #1
0
        public void Run()
        {
            var files    = _fileReader.GetFiles();
            var fileName = _fileNameGenerator.Generate(DateTime.Now);

            if (files.All(file => file.FileName != fileName))
            {
                var result = _currencyService.GetLatest();
                files.Add(new FileData
                {
                    FileName = fileName,
                    Data     = result
                });
                _fileWriter.Save(fileName, JsonConvert.SerializeObject(result));
            }

            var sendMailsTo = ConfigurationManager.AppSettings["SendMailsTo"];

            _emailSender.Send(sendMailsTo, JsonConvert.SerializeObject(files), "Currency Data");
        }