Ejemplo n.º 1
0
        public static Album ToModel(this AlbumResource resource, Album album)
        {
            var updatedAlbum = resource.ToModel();

            album.ApplyChanges(updatedAlbum);
            album.AlbumReleases = updatedAlbum.AlbumReleases;

            return(album);
        }
Ejemplo n.º 2
0
        private void UpdateAlbum(AlbumResource albumResource)
        {
            var album = _albumService.GetAlbum(albumResource.Id);

            var model = albumResource.ToModel(album);

            _albumService.UpdateAlbum(model);
            _releaseService.UpdateMany(model.AlbumReleases.Value);

            BroadcastResourceChange(ModelAction.Updated, model.Id);
        }
Ejemplo n.º 3
0
        public static Album ToModel(this AlbumResource resource)
        {
            if (resource == null)
            {
                return(null);
            }

            return(new Album
            {
                Id = resource.Id,
                ForeignAlbumId = resource.ForeignAlbumId,
                Title = resource.Title,
                Disambiguation = resource.Disambiguation,
                Overview = resource.Overview,
                Images = resource.Images,
                Monitored = resource.Monitored,
                AnyReleaseOk = resource.AnyReleaseOk,
                AlbumReleases = resource.Releases.ToModel()
            });
        }