private void AddTemplateToDB()
        {
            using (DatabaseContext databaseContext = new DatabaseContext())
            {
                QuestionListTemplateVM q = new QuestionListTemplateVM();
                q.toQuestionListTemplate().InspectionTypeId = SelectedInspectionType.Id;
                databaseContext.QuestionListTemplates.Add(q.toQuestionListTemplate());
                databaseContext.SaveChanges();

                MessageBox.Show("Template toegevoegd!", "Succes!", MessageBoxButton.OK, MessageBoxImage.Information);

                CloseWindow();
                return;

            }
        }
コード例 #2
0
 private void AddTemplate()
 {
     QuestionListTemplateVM qlt = new QuestionListTemplateVM();
     QuestionListTemplates.Add(qlt);
     using (DatabaseContext dbc = new DatabaseContext())
     {
         dbc.QuestionListTemplates.Add(qlt.toQuestionListTemplate());
         dbc.SaveChanges();
     }
 }