Exemplo n.º 1
0
        private Model.Album toModel(Entities.Album album)
        {
            List <string> pictures = new List <string>();

            foreach (ObjectId id in album.Pictures)
            {
                pictures.Add(id.ToString());
            }
            return(new Model.Album
            {
                Owner = album.Owner,
                Name = album.AlbumName,
                Thumbnail = new Model.Picture {
                    Id = pictures[0]
                }
            });
        }
Exemplo n.º 2
0
        private Model.AlbumDetails toModelDetails(Entities.Album album)
        {
            var pictures = album.Pictures.Select(p =>
            {
                var picture = pictureCollection.Find(p2 => p2.Id == p)
                              .Project(p3 => new Model.Picture
                {
                    Id   = p3.Id.ToString(),
                    Link = p3.Link
                })
                              .SingleOrDefault();
                return(picture);
            })
                           .ToList();

            return(new Model.AlbumDetails {
                Name = album.AlbumName,
                Owner = album.Owner,
                Pictures = pictures
            });
        }