Exemplo n.º 1
0
        public static Document ToDocument(Photograph photograph)
        {
            return(new Document
            {
                [Fields.Id] = photograph.Id.ToString(),

                [Fields.Title] = photograph.Title,
                [Fields.Layout] = LayoutSerialization.ToDocument(photograph.Layout),

                [Fields.Images] = new DynamoDBList(photograph.Images.Select(ImageSerialization.ToDocument)),

                [Fields.CaptureTime] = photograph.CaptureTime,
                [Fields.UploadTime] = photograph.UploadTime,
            });
        }
Exemplo n.º 2
0
        public static Photograph FromDocument(Document document)
        {
            return(new Photograph
            {
                Id = document[Fields.Id].AsGuid(),

                Title = document[Fields.Title].AsString(),
                Layout = LayoutSerialization.FromDocument(document.TryGetNull(Fields.Layout)),

                Images = document[Fields.Images].AsListOfDocument().Select(ImageSerialization.FromDocument).ToList(),

                CaptureTime = document[Fields.CaptureTime].AsDateTime(),
                UploadTime = document[Fields.UploadTime].AsDateTime(),
            });
        }