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; } }
private void AddTemplate() { QuestionListTemplateVM qlt = new QuestionListTemplateVM(); QuestionListTemplates.Add(qlt); using (DatabaseContext dbc = new DatabaseContext()) { dbc.QuestionListTemplates.Add(qlt.toQuestionListTemplate()); dbc.SaveChanges(); } }