public ChordViewModel GetChordViewModel(Key key, Alteration alteration, string chordQuality) { var dbChordQuality = _chordQualityService.GetByName(chordQuality); var chord = _chordService.GetChord(new Note(key, alteration), dbChordQuality); var vm = new ChordViewModel(); vm.Name = chord.Name; vm.Notes = chord.Notes.Select((n, i) => new NoteViewModel { Note = n, Interval = dbChordQuality.ChordQualityIntervals.ElementAt(i).Interval }).ToList(); vm.Notes.Add(new NoteViewModel { Interval = new Interval { Number = IntervalNumber.Fundamental, Quality = IntervalQuality.Perfect }, Note = chord.Fundamental }); vm.Notes = vm.Notes.OrderBy(n => n.Interval.Number).ToList(); return(vm); }
public IChord GetChord([FromServices] IChordService chordService, string note, Chords type) => chordService.GetChord(note, type);