public CategoriesController(MovieDemoWebApiContext context)
        {
            _context = context;

            if (_context.Categories.Count() == 0)
            {
                _context.Categories.Add(new Category {
                    Name = "Animation"
                });
                _context.Categories.Add(new Category {
                    Name = "Comedy"
                });
                _context.Categories.Add(new Category {
                    Name = "Horror"
                });
                _context.Categories.Add(new Category {
                    Name = "Thriller"
                });
                _context.SaveChanges();
            }
        }
Example #2
0
 public MoviesController(MovieDemoWebApiContext context)
 {
     _context = context;
 }