public SongInRanking(RankingList poll, Song song, int sortIndex) { ParamIs.NotNull(() => poll); ParamIs.NotNull(() => song); Ranking = poll; Song = song; SortIndex = sortIndex; }
public RankingContract(RankingList poll) { ParamIs.NotNull(() => poll); CreateDate = poll.CreateDate; Description = poll.Description; Id = poll.Id; Name = poll.Name; NicoId = poll.NicoId; Songs = poll.Songs.Select(m => new SongInRankingContract(m)).ToArray(); }
public void CreateWVRPoll(RankingContract contract) { HandleTransaction(session => { var poll = new RankingList(contract); foreach (var songContract in contract.Songs) { var c = songContract; var song = session.Query<Song>().FirstOrDefault(s => s.NicoId == c.NicoId); if (song == null) { song = new Song(songContract); session.Save(song); } poll.AddSong(song, songContract.SortIndex); session.Save(poll); } }); }