public Changeset TryTransformToChangeset(RootModel model, Taxonomy taxonomy)
        {
            var models   = this.traverser.TraverseGlobe(model.Globe);
            var otherOpt = models.Select(x => x.TryAsOther()).Where(x => x != null).SingleOrDefault();

            if (otherOpt == null)
            {
                return(null);                              // no other model, no unsaved baskets, no changeset
            }
            var changes = otherOpt.UnsavedBasketCountries.Select(
                x => new CountryBasketChange(x, otherOpt)
                );

            if (!changes.Any())
            {
                return(null);                            // no changes, no changeset
            }
            var change = new TaxonomyChange(taxonomy, model);

            var result = new Changeset(change, changes);

            return(result);
        }
Exemplo n.º 2
0
 public Changeset(TaxonomyChange taxonomyChange, IEnumerable<CountryBasketChange> changes)
 {
     this.TaxonomyChange = taxonomyChange;
     this.CountryBasketChanges = changes.ToList();
 }