async Task IGameResultRepository.AddGameResult( Guid deckID, Models.Client.GameResult gameResult) { using (await _asyncMutex.WaitAsync().ConfigureAwait(false)) { await _deckFileStorage.SaveAll( (await _deckFileStorage.GetAll().ConfigureAwait(false)) .Select( __deck => { if (__deck.DeckID != deckID) { return(__deck); } return (new Models.Data.Deck( __deck.DeckID, __deck.DeckString, __deck.Title, __deck.Position, __deck.GameResults.Append( new Models.Data.GameResult( gameResult.Timestamp, gameResult.GameWon, gameResult.OpponentClass)))); })).ConfigureAwait(false); } }
async Task <IEnumerable <Models.Client.Deck> > IDeckRepository.GetAllDecks() { return ((await _deckFileStorage.GetAll().ConfigureAwait(false)) .Select( __deck => new Models.Client.Deck( __deck.DeckID, __deck.DeckString, __deck.Title, __deck.Position, __deck.GameResults .Select( __gameResult => new Models.Client.GameResult( __gameResult.Timestamp, __gameResult.GameWon, __gameResult.OpponentClass))))); }