Ejemplo n.º 1
0
 private void MapValue(Dnd35CharacterViewModel.Ability ability, BsonDocument bsonDocument, string field)
 {
     bsonDocument.Add(field, () => new BsonDocument(new Dictionary <string, object>
     {
         { score, ability.Score },
         { modifier, ability.Modifier }
     }), ability != null);
 }
Ejemplo n.º 2
0
        protected Dnd35CharacterViewModel.Ability MapValue(BsonDocument document, string field, Dnd35CharacterViewModel.Ability dontCare)
        {
            Dnd35CharacterViewModel.Ability ability = null;
            BsonValue bsonValue;

            if (document.TryGetValue(field, out bsonValue) && bsonValue.IsBsonDocument)
            {
                var abilityDocument = bsonValue.AsBsonDocument;
                ability = new Dnd35CharacterViewModel.Ability
                {
                    Score    = MapValue(abilityDocument, score, 0),
                    Modifier = MapValue(abilityDocument, modifier, 0)
                };
            }
            return(ability);
        }