예제 #1
0
        private static void SeedGenres(ApplicationDbContext context)
        {
            var noGenre = new Models.Genre
            {
                Id   = "none",
                Name = "None"
            };

            context.Genres.AddOrUpdate(
                noGenre,
                new Models.Genre
            {
                Id   = "action",
                Name = "Action"
            }
                );

            context.Movies
            .Where(movie => movie.Genre == null)
            .ToList()
            .ForEach(movie => movie.Genre = noGenre);

            context.SaveChanges();
        }
예제 #2
0
파일: Song.cs 프로젝트: nataliena/CSharp
 public Song(string title, int length, Genre genre)
 {
     this.Title  = title;
     this.Length = length;
     this.Genre  = genre;
 }