public List <Movie> GetAll( ) { using (MovieIndexContext context = new MovieIndexContext( )) { return((from m in context.Movies.Include(m => m.Genre) select m).ToList( )); } }
public List<Movie> GetAll( ) { using ( MovieIndexContext context = new MovieIndexContext( ) ) { return ( from m in context.Movies.Include( m => m.Genre ) select m ).ToList( ); } }
public List<Genre> GetAll( ) { using ( MovieIndexContext context = new MovieIndexContext( ) ) { return ( from g in context.Genres select g ).ToList( ); } }
public List <Genre> GetAll( ) { using (MovieIndexContext context = new MovieIndexContext( )) { return((from g in context.Genres select g).ToList( )); } }
public Movie GetById( int id ) { using ( MovieIndexContext context = new MovieIndexContext( ) ) { return ( from m in context.Movies where m.Id == id select m ).SingleOrDefault( ); } }
public void Create( Movie movie ) { using ( MovieIndexContext context = new MovieIndexContext( ) ) { context.Movies.Add( movie ); context.SaveChanges( ); } }
public void Update( Movie movie ) { using ( MovieIndexContext context = new MovieIndexContext( ) ) { context.Entry( movie ).State = EntityState.Modified; context.SaveChanges( ); } }
public void Update(Movie movie) { using (MovieIndexContext context = new MovieIndexContext( )) { context.Entry(movie).State = EntityState.Modified; context.SaveChanges( ); } }
public void Create(Movie movie) { using (MovieIndexContext context = new MovieIndexContext( )) { context.Movies.Add(movie); context.SaveChanges( ); } }
public Movie GetById(int id) { using (MovieIndexContext context = new MovieIndexContext( )) { return((from m in context.Movies where m.Id == id select m).SingleOrDefault( )); } }
public List <Movie> GetByName(string name) { using (MovieIndexContext context = new MovieIndexContext( )) { return((from m in context.Movies.Include(m => m.Genre) where m.Name.StartsWith(name) select m).ToList( )); } }
public List<Movie> GetByName( string name ) { using ( MovieIndexContext context = new MovieIndexContext( ) ) { return ( from m in context.Movies.Include( m => m.Genre ) where m.Name.StartsWith( name ) select m ).ToList( ); } }
public void Delete(int id) { using (MovieIndexContext context = new MovieIndexContext( )) { Movie movie = context.Movies.Find(id); context.Movies.Remove(movie); context.SaveChanges( ); } }
public void Delete( int id ) { using ( MovieIndexContext context = new MovieIndexContext( ) ) { Movie movie = context.Movies.Find( id ); context.Movies.Remove( movie ); context.SaveChanges( ); } }
public async Task<List<Director>> GetAllAsync( ) { return await Task.Run( ( ) => { using ( MovieIndexContext context = new MovieIndexContext( ) ) { return ( from d in context.Directors select d ).ToList( ); } } ); }
public async Task <List <Director> > GetAllAsync( ) { return(await Task.Run(() => { using (MovieIndexContext context = new MovieIndexContext( )) { return (from d in context.Directors select d).ToList( ); } })); }
public async Task<List<Director>> GetByNameAsync( string name ) { return await Task.Run( ( ) => { using ( MovieIndexContext context = new MovieIndexContext( ) ) { return ( from d in context.Directors where d.FullName.ToLower( ).Contains( name.ToLower( ) ) select d ).ToList( ); } } ); }
public async Task <List <Director> > GetByNameAsync(string name) { return(await Task.Run(() => { using (MovieIndexContext context = new MovieIndexContext( )) { return (from d in context.Directors where d.FullName.ToLower( ).Contains(name.ToLower( )) select d).ToList( ); } })); }