示例#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;
        }
示例#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 );
     }
 }
示例#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 );
            }
        }