Exemple #1
0
        public void SaveTemplate(Template template)
        {
            if (!_lockDict.ContainsKey(template.Name))
                _lockDict.Add(template.Name, new object());

            lock (_lockDict[template.Name])
            {
                var filepath = Path.Combine(HttpContext.Current.Server.MapPath("~/templates"), template.Name + ".txt");
                File.WriteAllText(filepath, template.Content);
            }
        }
Exemple #2
0
        protected void btnSaveTemplate_Click(object sender, EventArgs e)
        {
            var template = new Template { Name=txtTemplateName.Text, Content=txtTemplate.Text };
            _svc.SaveTemplate(template);
            BindDataList();

            SelectedTabIndex = 2;
        }