Пример #1
0
        public async Task RunAsync(ILogger logger)
        {
            var tableClient    = _cloudStorageClientFactory.CreateTableClient();
            var templatesTable = tableClient.GetTableReference("templates");
            await templatesTable.DeleteIfExistsAsync();

            foreach (var directory in Directory.EnumerateDirectories(Path.Combine(Directory.GetCurrentDirectory(), "Data", "Templates")))
            {
                var template       = JsonConvert.DeserializeObject <TemplateCreate>(File.ReadAllText(Path.Combine(directory, "metadata.json")));
                var templateMarkup = File.ReadAllText(Path.Combine(directory, "markup.xml"));

                template.Markup = templateMarkup;

                await _templateService.CreateTemplateAsync(template);
            }
        }