Ejemplo n.º 1
0
        public static void Initialize(EssenceContext context)
        {
            if (!context.Musics.Any())
            {
                context.Musics.AddRange(
                    new Music
                {
                    Executor = "Alan Walker",
                    Name     = "Fade",
                    Genre    = "Club",
                    Lenght   = 100
                },
                    new Music
                {
                    Executor = "Scorpions",
                    Name     = "Last song",
                    Genre    = "Rock",
                    Lenght   = 200
                },
                    new Music
                {
                    Executor = "Skillet",
                    Name     = "Rise",
                    Genre    = "Rock",
                    Lenght   = 150
                }
                    );
                context.SaveChanges();
            }

            if (!context.Alcohols.Any())
            {
                context.Alcohols.AddRange(
                    new Alcohol
                {
                    Brand    = "Триозерье",
                    Type     = "Водка",
                    Volume   = 15,
                    Strength = 40
                },
                    new Alcohol
                {
                    Brand    = "Jack Daniel's",
                    Type     = "Виски",
                    Volume   = 20,
                    Strength = 40
                }
                    );
            }
            context.SaveChanges();
        }
Ejemplo n.º 2
0
 public MusicController(EssenceContext context)
 {
     _context = context;
 }
Ejemplo n.º 3
0
 public AlcoholController(EssenceContext context)
 {
     db = context;
 }