コード例 #1
0
        public MoviesController(EntityBoxContext context)
        {
            _context = context;

            if (!_context.Movies.Any())
            {
                _context.Movies.Add(new Movie
                {
                    Slug  = "american-beauty",
                    Title = "American Beauty"
                });
                _context.Movies.Add(new Movie
                {
                    Slug  = "12-angry-man",
                    Title = "12 Angry Man"
                });
                _context.SaveChanges();
            }
        }
コード例 #2
0
        public PersonsController(EntityBoxContext context)
        {
            _context = context;

            if (!_context.Persons.Any())
            {
                _context.Persons.Add(new Person
                {
                    Slug = "john",
                    Name = "John"
                });
                _context.Persons.Add(new Person
                {
                    Slug = "doe",
                    Name = "Doe"
                });
                _context.SaveChanges();
            }
        }
コード例 #3
0
        public CountriesController(EntityBoxContext context)
        {
            _context = context;

            if (!_context.Countries.Any())
            {
                _context.Countries.Add(new Country
                {
                    Slug = "portugal",
                    Name = "Portugal"
                });
                _context.Countries.Add(new Country
                {
                    Slug = "spain",
                    Name = "Spain"
                });
                _context.SaveChanges();
            }
        }
コード例 #4
0
        public GenresController(EntityBoxContext context)
        {
            _context = context;

            if (!_context.Genres.Any())
            {
                _context.Genres.Add(new Genre
                {
                    Slug        = "drama",
                    Title       = "Drama",
                    Description = "A drama genre."
                });
                _context.Genres.Add(new Genre
                {
                    Slug        = "fantasy",
                    Title       = "Fantasy",
                    Description = "A fantasy genre."
                });
                _context.SaveChanges();
            }
        }