示例#1
0
        private void InitializeDbContext()
        {
            var optionsBuilder = new DbContextOptionsBuilder <VidlyDbContext>();

            optionsBuilder.UseSqlite("Data Source=vidly.db");

            _dbContext = new VidlyDbContext(optionsBuilder.Options);
        }
示例#2
0
 public UnitOFWork(VidlyDbContext VidlyModel)
 {
     this.VidlyModel                = VidlyModel;
     this.CustomerRepository        = new CustomerRepository(VidlyModel);
     this.MovieRepository           = new MovieRepository(VidlyModel);
     this.MemmberShipTypeRepository = new MemmberShipTypeRepository(VidlyModel);
     this.GenreRepository           = new GenreRepository(VidlyModel);
     this.RentalRepository          = new RentalRepository(VidlyModel);
     this.RentalDetailsRepository   = new RentalDetailsRepository(VidlyModel);
     this.UserRepository            = new UsersRepository(VidlyModel);
 }
示例#3
0
        public void Example03()
        {
            using (var db = new VidlyDbContext())
            {
                var customers = db.Customers.Include(c => c.MembershipTypeCode).ToList();

                foreach (var item in customers)
                {
                    Console.WriteLine($"Display Name: {item.DisplayName}, Email Address: {item.EmailAddress}, Membership Type Id: {item.MembershipTypeCodeId}, Membership Type {item.MembershipTypeCode.MembershipTypeDesc}");
                }
            }
        }
示例#4
0
        public void Example01()
        {
            using (var db = new VidlyDbContext())
            {
                var membershipTypes = db.MembershipTypeCodes.ToList();

                Console.WriteLine("Membership Types...");
                foreach (var m in membershipTypes)
                {
                    Console.WriteLine($"MembershipTypeId: {m.MembershipTypeCodeId}, MembershipTypeName: {m.MembershipTypeDesc}");
                }
            }
        }
示例#5
0
        public void Example01()
        {
            using (var db = new VidlyDbContext())
            {
                var result = db.Movies.Include(m => m.MovieGenreCode).ToList();

                Console.WriteLine("All movies in the database are as follows...");
                Console.WriteLine();
                foreach (var item in result)
                {
                    Console.WriteLine($"Movie Name: {item.MovieName}, Release Date: {item.ReleaseDate}, Genre: {item.MovieGenreCode.Genre}");
                }
            }
        }
示例#6
0
        public void Example02()
        {
            using (var db = new VidlyDbContext())
            {
                var result = db.Movies.Include(m => m.MovieDetail).ToList();

                Console.WriteLine("All movies in the database with their details are as follows...");
                Console.WriteLine();
                foreach (var item in result)
                {
                    Console.WriteLine($"Movie Name: {item.MovieName}, Release Date: {item.ReleaseDate}, Runtime: {item.Runtime}, IMDB URL: {item.MovieDetail.ImdbUrl}");
                }
            }
        }
示例#7
0
        public void Example02()
        {
            using (var db = new VidlyDbContext())
            {
                var genres = db.MovieGenreCodes.ToList();
                Console.WriteLine("Genres Types (from codes schema)...");

                foreach (var g in genres)
                {
                    Console.WriteLine($"Genre Id: {g.Id}, Genre: {g.Genre}, Is Active? {g.IsActive}");
                }

                var ratings = db.MovieRatingCodes.ToList();
                Console.WriteLine("Rating Types (from codes schema)...");
                foreach (var r in ratings)
                {
                    Console.WriteLine($"Rating Id: {r.Id}, Rating: {r.Rating}, Is Active? {r.IsActive}");
                }
            }
        }
示例#8
0
        public void Example01()
        {
            using (var db = new VidlyDbContext())
            {
                var result = db.Customers.ToList();

                Console.WriteLine("All customers in the database are as follows...");
                Console.WriteLine();
                foreach (var item in result)
                {
                    /*****************************************************************************************************************************************************************
                     * Example of Interpolated Strings: An interpolated string looks like a template string that contains interpolated expressions.
                     * Example of the "Elvis" Operator: returns one of two values depending on the value of a Boolean expression. condition ? first_expression : second_expression;
                     ******************************************************************************************************************************************************************/
                    Console.WriteLine("Display Name: {0}, Email Address: {1}, Date of Birth: {2}"
                                      , item.DisplayName
                                      , item.EmailAddress
                                      , item.Dob != null ? $"{item.Dob:MM/dd/yy}" : "Unknown");
                }
            }
        }
示例#9
0
 public MovieController()
 {
     _context = new VidlyDbContext();
 }
示例#10
0
 public GenreRepository(VidlyDbContext context)
     : base(context)
 {
 }
示例#11
0
 public UsersRepository(VidlyDbContext context)
     : base(context)
 {
     this.context = context;
 }
示例#12
0
 /// <summary>
 /// .....
 /// </summary>
 public MembershipTypeCodesController()
 {
     _context = new VidlyDbContext();
 }
示例#13
0
 public RentalRepository(VidlyDbContext context)
     : base(context)
 {
     this.context = context;
 }
示例#14
0
 public MovieRatingCodesController()
 {
     _context = new VidlyDbContext();
 }
 public CustomersController(VidlyDbContext context)
 {
     _context = context;
 }
 public RentalDetailsRepository(VidlyDbContext context)
     : base(context)
 {
 }
 public MovieGenreCodesController()
 {
     _context = new VidlyDbContext();
 }
 public CustomerRepository(VidlyDbContext context)
     : base(context)
 {
     this.context = context;
 }
示例#19
0
 public MemmberShipTypeRepository(VidlyDbContext context)
     : base(context)
 {
 }
示例#20
0
 public MoviesController()
 {
     _dbContext = new VidlyDbContext();
 }
示例#21
0
 public MoviesController()
 {
     _context = new VidlyDbContext();
     _context.Configuration.ProxyCreationEnabled = false;
 }
示例#22
0
 public MovieRepository(VidlyDbContext context)
     : base(context)
 {
     this.context = context;
 }
示例#23
0
 public Repository(VidlyDbContext context)
 {
     this.context = context;
 }
 public MoviesController(VidlyDbContext context)
 {
     _context = context;
 }
 public InstallmentCodesController()
 {
     _context = new VidlyDbContext();
 }
示例#26
0
 public StaffsController()
 {
     db = new VidlyDbContext();
 }
示例#27
0
 public CustomersController()
 {
     _context = new VidlyDbContext();
 }
示例#28
0
 public CustomersController(VidlyDbContext context)
 {
     _context = context;
     _random  = new Random();
 }