public TestEdit(Tests test) { TestEditViewModel viewModel = new TestEditViewModel(test); this.DataContext = viewModel; InitializeComponent(); }
public TestEditViewModel(Tests test) { _currentTest = test; _currentQuestion = new QuestionModel(); _testQuestions = new ObservableCollection<QuestionModel>(); }
private async void btnAddTest_Click(object sender, RoutedEventArgs e) { int id; string name = await this.ShowInputAsync("Name", "Please, enter test name", null); if(name != null) { using (var context = new QuizDBEntities()) { id = context.Tests.ToList().Select(t => t.id).Max() + 1; } Tests test = new Tests(); test.id = id; test.name = name; var view = new TestEdit(test); this.Close(); view.Show(); } }