コード例 #1
0
 public SearchController(ShareMusicMvcContext context)
 {
     _context = context;
 }
コード例 #2
0
 public PostsController(ShareMusicMvcContext context, IWebHostEnvironment webHostEnvironment)
 {
     _webHostEnvironment = webHostEnvironment;
     _context            = context;
     //_userManager = userManager;
 }
コード例 #3
0
 public HomeController(ILogger <HomeController> logger, ShareMusicMvcContext context)
 {
     _logger  = logger;
     _context = context;
 }
コード例 #4
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new ShareMusicMvcContext(
                       serviceProvider.GetRequiredService <
                           DbContextOptions <ShareMusicMvcContext> >()))
            {
                // Look for any movies.
                if (context.Categories.Any())
                {
                    return;   // DB has been seeded
                }
                context.Categories.AddRange(
                    new Category
                {
                    Name        = "tre",
                    Description = "Nhạc trẻ"
                },
                    new Category
                {
                    Name        = "rap",
                    Description = "Nhạc Rap"
                },
                    new Category
                {
                    Name        = "bolero",
                    Description = "Nhạc Bolero"
                },
                    new Category
                {
                    Name        = "edm",
                    Description = "Nhạc EDM"
                },
                    new Category
                {
                    Name        = "khongloi",
                    Description = "Nhạc không lời"
                },

                    new Category
                {
                    Name        = "acoustic",
                    Description = "Nhạc Acoustic"
                },
                    new Category
                {
                    Name        = "usuk",
                    Description = "Nhạc US-UK"
                },
                    new Category
                {
                    Name        = "kpop",
                    Description = "Nhạc K-pop"
                },
                    new Category
                {
                    Name        = "tinhyeu",
                    Description = "Nhạc tình yêu"
                }
                    );
                context.SaveChanges();
            }
        }
コード例 #5
0
 public AdminController(ShareMusicMvcContext context, UserManager <ShareMusicMvcUser> userManager)
 {
     _userManager = userManager;
     _context     = context;
 }