Ejemplo n.º 1
0
        //DTO to domain object
        public override Item ToDomainObject(Node parent)
        {
            var newNode = new Node()
            {
                Key     = this.Key,
                Parent  = parent,
                Note    = this.Note,
                Deleted = this.Deleted,
                Notes   = DtoNote.DtoNoteListToDomainObjecs(this.Notes),
                //CreatedOn = DateTime.Parse(this.CreatedOn, null, System.Globalization.DateTimeStyles.RoundtripKind),
                //UpdatedOn = DateTime.Parse(this.UpdatedOn, null, System.Globalization.DateTimeStyles.RoundtripKind)
            };

            return(newNode);
        }
Ejemplo n.º 2
0
        //Dto to domain object
        public override Item ToDomainObject(Node parent)
        {
            var newLeaf = new Leaf()
            {
                Key     = this.Key,
                Parent  = parent,
                Deleted = this.Deleted,
                Value   = this.Value,
                Notes   = DtoNote.DtoNoteListToDomainObjecs(this.Notes),
                Stale   = this.Stale,
                //CreatedOn = DateTime.Parse(this.CreatedOn, null, System.Globalization.DateTimeStyles.RoundtripKind),
                //UpdatedOn = DateTime.Parse(this.UpdatedOn, null, System.Globalization.DateTimeStyles.RoundtripKind)
            };

            if (parent == null)
            {
                throw new InvalidDataException("Leaf must have a parent."); // TODO: Throw 4XX rather than 5XX
            }

            return(newLeaf);
        }