Ejemplo n.º 1
0
        public void UpdateAlbum(Album album)
        {
            var context = new PhotoAlbumDataContext();
            var albumRow = new AlbumRow(album);

            // attach and update the photo row
            context.AttachTo(PhotoAlbumDataContext.AlbumTable, albumRow, "*");
            context.UpdateObject(albumRow);

            context.SaveChanges();
        }
Ejemplo n.º 2
0
        public void CreateAlbum(string albumName, string owner)
        {
            var context = new PhotoAlbumDataContext();

            var album = new Album
            {
                AlbumId = SlugHelper.GetSlug(albumName),
                Owner = owner.ToLowerInvariant(),
                Title = albumName
            };

            context.AddObject(PhotoAlbumDataContext.AlbumTable, new AlbumRow(album));
            context.SaveChanges();
        }