public ShowsController(CinemaManagerContext context,
                        UserManager <IdentityUser> userManager,
                        RoleManager <IdentityRole> roleManager)
 {
     _context     = context;
     _userManager = userManager;
 }
예제 #2
0
 public UsersController(
     UserManager <IdentityUser> userManager,
     CinemaManagerContext context,
     RoleManager <IdentityRole> roleManager,
     IConfiguration configuration)
 {
     _userManager   = userManager;
     _context       = context;
     _roleManager   = roleManager;
     _configuration = configuration;
     CipherKey      = _configuration.GetValue <int>("CipherKey");
 }
예제 #3
0
 public IndexModel(
     UserManager <IdentityUser> userManager,
     SignInManager <IdentityUser> signInManager,
     CinemaManagerContext context,
     IConfiguration configuration)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _context       = context;
     _configuration = configuration;
     CipherKey      = _configuration.GetValue <int>("CipherKey");
 }
 public FilmsController(CinemaManagerContext context)
 {
     _context = context;
 }
예제 #5
0
 public HallsController(CinemaManagerContext context)
 {
     _context = context;
 }
예제 #6
0
 public DeleteModel(CinemaManagerContext context)
 {
     _context = context;
 }
예제 #7
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new CinemaManagerContext(
                       serviceProvider.GetRequiredService <
                           DbContextOptions <CinemaManagerContext> >()))
            {
                if (!context.Films.Any())
                {
                    context.Films.AddRange(
                        new Film
                    {
                        Title = "Pulp Fiction"
                    },

                        new Film
                    {
                        Title = "Rio Bravo"
                    },

                        new Film
                    {
                        Title = "Ghostbusters"
                    }
                        );

                    context.Halls.AddRange(
                        new Hall
                    {
                        Nr      = 1,
                        Rows    = 3,
                        Columns = 3
                    },
                        new Hall
                    {
                        Nr      = 2,
                        Rows    = 5,
                        Columns = 5
                    }
                        );

                    context.SaveChanges();

                    context.Shows.AddRange(
                        new Show
                    {
                        ShowDate = DateTime.Parse("1989-2-12"),
                        Genre    = "Romantic Comedy",
                        Price    = 7.99M,
                        Film     = context.Films.FirstOrDefault(q => q.Title == "Rio Bravo"),
                        Hall     = context.Halls.FirstOrDefault(h => h.Nr == 1)
                    },

                        new Show
                    {
                        ShowDate = DateTime.Parse("1984-3-13"),
                        Genre    = "Comedy",
                        Price    = 8.99M,
                        Film     = context.Films.FirstOrDefault(q => q.Title == "Pulp Fiction"),
                        Hall     = context.Halls.FirstOrDefault(h => h.Nr == 1)
                    },

                        new Show
                    {
                        ShowDate = DateTime.Parse("1986-2-23"),
                        Genre    = "Comedy",
                        Price    = 9.99M,
                        Film     = context.Films.FirstOrDefault(q => q.Title == "Ghostbusters"),
                        Hall     = context.Halls.FirstOrDefault(h => h.Nr == 1)
                    }
                        );

                    context.SaveChanges();
                }
            }
        }