Exemple #1
0
        public void Insert(SongbookDto dto)
        {
            if (dto == null)
            {
                return;
            }

            _logger.LogInformation("Inserting 'Songbook' record {@dto}", dto);
            DataSource.Songbooks.Add(dto);
        }
Exemple #2
0
        public Seed()
        {
            var defaultSongbook = new SongbookDto()
            {
                Id        = new Guid("21924d66-dac6-43a5-beee-206de4d35216"),
                Title     = "Psalms, Hymns, and Spiritual Songs",
                ISBN10    = "1584273526",
                ISBN13    = "9781584273523",
                Publisher = "Sumphonia Productions LLD (2012)"
            };

            var defaultSongbookCreators = new List <CreatorDto>()
            {
                new CreatorDto()
                {
                    Id = new Guid("fdfba83c-08aa-42a4-b1c1-46b8e154f297"), ParentId = defaultSongbook.Id, FirstName = "David", LastName = "Maravilla", ParentTypeId = (int)CreativeType.Editor, TypeId = (int)CreatorParentType.Songbook
                },
                new CreatorDto()
                {
                    Id = new Guid("e2495b99-9fd0-4be6-b2db-893ce69a6f38"), ParentId = defaultSongbook.Id, FirstName = "Matt", LastName = "Bassford", ParentTypeId = (int)CreativeType.TechnicalEditor, TypeId = (int)CreatorParentType.Songbook
                }
            };

            var defaultSong = new SongDto()
            {
                Id            = new Guid("6767f7f5-0dc9-4b78-a0f0-e450e4b60889"),
                SongbookId    = defaultSongbook.Id,
                Title         = "Nearer, My God, to Thee",
                SongNumber    = 328,
                Key           = "G",
                SolfaTypeId   = (int)SolfaType.Mi,
                TimeSignature = "4/4",
                Tune          = "Bethany"
            };

            var defaultSongCreator = new CreatorDto()
            {
                Id = new Guid("d3788116-90f7-40d4-9a82-a3cef6e769df"), ParentId = defaultSong.Id, FirstName = "Sarah Flower", LastName = "Adams", ParentTypeId = (int)CreativeType.Writer, TypeId = (int)CreatorParentType.Song
            };

            Songbooks.Add(defaultSongbook);
            Songs.Add(defaultSong);
            Creators.AddRange(defaultSongbookCreators);
            Creators.Add(defaultSongCreator);
        }
Exemple #3
0
        public void Update(SongbookDto dto)
        {
            if (dto == null)
            {
                return;
            }

            _logger.LogInformation("Updating 'Songbook' record {@dto}", dto);
            var existingSongbook = DataSource.Songbooks.FirstOrDefault(sb => sb.Id == dto.Id);

            if (existingSongbook == null)
            {
                return;
            }

            DataSource.Songbooks.Remove(existingSongbook);
            DataSource.Songbooks.Add(dto);
        }
Exemple #4
0
        public static Songbook From(SongbookDto dto)
        {
            if (dto == null)
            {
                return(null);
            }

            return(new Songbook()
            {
                Id = dto.Id,
                Title = dto.Title,
                Publisher = dto.Publisher,
                ISBN10 = dto.ISBN10,
                ISBN13 = dto.ISBN13,
                Creators = dto.Creators?.Select(Creator.From).ToList() ?? new List <Creator>(),
                Songs = dto.Songs?.Select(Song.From).ToList() ?? new List <Song>()
            });
        }