public async Task LoadPlayer(bool isRefreshing) { Either <PlayerResponse, ErrorResponse> response = await RequestAsync(!isRefreshing, () => _playerRepository.GetPlayer(View.PlayerId)); response .ConfigureNotFound("Player not found") .OnSuccess(data => View.ShowPlayer(new PlayerViewModel(data))) .OnError(error => View.Error.Show(error)); }
public async Task LoadPlayers(bool isRefreshing) { Either <PlayerListResponse, ErrorResponse> response = await RequestAsync(!isRefreshing, _playerRepository.GetPlayers); response .ConfigureNotFound(data => data.Players.Any( ), "No players found") .OnSuccess(data => View.ShowPlayers(new PlayerListViewModel(data))) .OnError(error => { View.Error.Show(error); }); }