Example #1
0
        public Artist EditArtist( Artist artist, HttpServerUtilityBase server )
        {
            if( artist == null ) throw new ArgumentException( "Artist can't be null" );
            if( server == null ) throw new ArgumentException( "Server can't be null" );
            if( !ArtistExists( artist ) ) return null;

            return artist;
        }
Example #2
0
 public bool ArtistExists( Artist artist )
 {
     if( artist == null ) throw new ArgumentException("Artist can't be null");
     using( var ctx = new NwdBackOfficeContext() )
     {
         return ctx.Artists.Any( a => a.Name == artist.Name );
     }
 }
Example #3
0
        public Artist CreateArtist( Artist artist, HttpServerUtilityBase server )
        {
            if( artist == null ) throw new ArgumentException( "Artist can't be null" );
            if( server == null ) throw new ArgumentException( "Server can't be null" );

            using( var ctx = new NwdBackOfficeContext() )
            {
                if( !ArtistExists( artist ) ) ctx.Artists.Add( artist );
                ctx.SaveChanges();
                return ctx.Artists.Single( a => a.Name == artist.Name );
            }
        }