Beispiel #1
0
 public static IEnumerable <Movie> GetAll()
 {
     using (var context = new VidlyContext())
     {
         return(context.Movies.Include("Genre").ToList());
     }
 }
Beispiel #2
0
 public static Genre GetById(int id)
 {
     using (var context = new VidlyContext())
     {
         return(context.Genres.Find(id));
     }
 }
Beispiel #3
0
 public static Movie GetById(int Id)
 {
     using (var context = new VidlyContext())
     {
         return(context.Movies.Include("Genre").SingleOrDefault(m => m.Id == Id));
     }
 }
Beispiel #4
0
 public static IEnumerable <Genre> GetAll()
 {
     using (var context = new VidlyContext())
     {
         return(context.Genres.ToList());
     }
 }
Beispiel #5
0
 public static void Add(Genre genre)
 {
     using (var context = new VidlyContext())
     {
         context.Genres.Add(genre);
         context.SaveChanges();
     }
 }
Beispiel #6
0
 public static void Add(Movie movie)
 {
     using (var context = new VidlyContext())
     {
         context.Movies.Add(movie);
         context.SaveChanges();
     }
 }
 public CustomersControllerNotRestful(VidlyContext context, IMapper mapper)
 {
     //_context = new VidlyContext();
     //var config = new MapperConfiguration(cfg => cfg.CreateMap<Customer, CustomerDto>());
     //_mapper = config.CreateMapper();
     _context = context;
     _mapper  = mapper;
 }
Beispiel #8
0
 public static void Delete(int id)
 {
     using (var context = new VidlyContext())
     {
         Genre genre = context.Genres.Find(id);
         context.Genres.Remove(genre);
         context.SaveChanges();
     }
 }
Beispiel #9
0
 public static void Update(Genre genre)
 {
     using (var context = new VidlyContext())
     {
         Genre genreToUpdate = context.Genres.Find(genre.Id);
         genreToUpdate.Name = genre.Name;
         context.SaveChanges();
     }
 }
Beispiel #10
0
 public static void Delete(int id)
 {
     using (var context = new VidlyContext())
     {
         Movie movie = context.Movies.Find(id);
         context.Movies.Remove(movie);
         context.SaveChanges();
     }
 }
Beispiel #11
0
 public static void Update(Movie movie)
 {
     using (var context = new VidlyContext())
     {
         Movie movieToUpdate = context.Movies.Find(movie.Id);
         movieToUpdate.GenreId     = movie.GenreId;
         movieToUpdate.Name        = movie.Name;
         movieToUpdate.ReleaseDate = movie.ReleaseDate;
         context.SaveChanges();
     }
 }
 public NewRentalController()
 {
     _context = new VidlyContext();
 }
Beispiel #13
0
 public MoviesController()
 {
     //initialize context instance
     _context = new VidlyContext();
 }
Beispiel #14
0
 public RentalRepository(VidlyContext context) : base(context) => this.context = context;
Beispiel #15
0
 public MovieRepository(VidlyContext context) : base(context) => this.context = context;
 public VidlyRepository(VidlyContext context)
 {
     _context = context;
 }
Beispiel #17
0
 public CustomersController(VidlyContext vc)
 {
     vidlyContext = vc;
 }
Beispiel #18
0
 public MoviesController(VidlyContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
Beispiel #19
0
 public CustomersController(IMapper mapper)
 {
     _context = new VidlyContext();
     _mapper  = mapper ?? throw new ArgumentNullException(nameof(mapper));
 }
Beispiel #20
0
 public RentalsController()
 {
     _context = new VidlyContext();
 }
Beispiel #21
0
 public CustomerRepository(VidlyContext context) : base(context) => this.context = context;
Beispiel #22
0
 public MovieController()
 {
     _dbContext = new VidlyContext();
 }
Beispiel #23
0
 public UserController()
 {
     _context = new VidlyContext();
 }
 public UnitOfWork(VidlyContext context)
 {
     _context = context;
 }
Beispiel #25
0
 public CustomersController()
 {
     _context = new VidlyContext();
 }
Beispiel #26
0
 public UnitOfWork(VidlyContext context) => this.context = context;
Beispiel #27
0
 public MoviesController(VidlyContext context)
 {
     _context = context;
 }
Beispiel #28
0
 public CustomersController()
 {
     //Initialize DbContext
     _context = new VidlyContext();
 }
Beispiel #29
0
 public MoviesController()
 {
     _context = new VidlyContext();
 }
Beispiel #30
0
 public MoviesController()
 {
     _dbContext = new VidlyContext();
     _mapper    = new Mapper(config);
 }