public ScenarioModel(MapScenarioModel source, MapModel map, RepoInfo repo, ScenarioModel parent)
            : base(source.Id, repo)
        {
            Title   = source.Title;
            Summary = source.Summary;
            Parent  = parent;

            if (source.Children != null)
            {
                foreach (var childScenario in source.Children)
                {
                    ChildrenScenarios.Add(new ScenarioModel(childScenario, map, repo, this));
                }
            }

            if (source.ProposalExamples != null)
            {
                foreach (var proposal in source.ProposalExamples)
                {
                    var p = new ProposalExampleModel(this, proposal, map, repo);
                    if (p.Info != null)
                    {
                        // Don't allow duplicate proposals
                        if (!Proposals.Any(i => i.ProposalId == p.ProposalId))
                        {
                            Proposals.Add(p);
                        }
                    }
                }
            }
        }
Example #2
0
 public ProposalExampleModel(ScenarioModel parentScenario, MapProposalExampleModel source, MapModel map, RepoInfo repo)
     : base(parentScenario.Id + "-" + source.ProposalId, repo)
 {
     ParentScenario = parentScenario;
     ProposalId     = source.ProposalId;
     Info           = map.Proposals?.FirstOrDefault(i => i.Id == source.ProposalId);
 }