public void DeleteScenario(ScenarioViewModel scenarioViewModel) { scenarioViewModel.IsSelected = false; scenarioViewModel.IsExpanded = false; Scenarios.Remove(scenarioViewModel.Scenario); Story.ChildrenIds.Remove(scenarioViewModel.Scenario.Id); base.Children.Clear(); OnPropertyChanged("Scenarios"); OnPropertyChanged("Children"); repo.Delete<Scenario>(scenarioViewModel.Scenario); repo.Save<Story>(Story); }
public void DeleteScenario(ScenarioViewModel scenarioViewModel) { scenarioViewModel.ShouldDelete = true; var projectViewModel = ProjectViewModels.First(p => p.Children.Any(c => c.Children.Contains(scenarioViewModel))); var storyViewModel = projectViewModel.Children.First(c => c.Children.Contains(scenarioViewModel)) as StoryViewModel; storyViewModel.DeleteScenario(scenarioViewModel); }
public void CreateScenario() { var scenario = new Scenario() { ParentId = Story.Id }; var interaction = new Interaction() { ParentId = scenario.Id }; var dataItem = new DataItem() { ParentId = interaction.Id }; interaction.DataItems.Add(dataItem); scenario.Interactions.Add(interaction); scenario.Name = "Scenario Name"; Scenarios.Add(scenario); Story.ChildrenIds.Add(scenario.Id); var scenarioViewModel = new ScenarioViewModel(scenario, this) { IsSelected = true, IsExpanded = true }; base.Children.Add(scenarioViewModel); Update(); }