public DystirService( DbContextOptions <DystirDBContext> dbContextOptions, StandingService standingService, StatisticCompetitionsService statisticCompetitionsService, HubConnection hubConnection, IHubContext <DystirHub> hubContext) { _dbContextOptions = dbContextOptions; _dystirDBContext = new DystirDBContext(_dbContextOptions); _standingService = standingService; _statisticCompetitionsService = statisticCompetitionsService; _hubConnection = hubConnection; _hubContext = hubContext; AllMatchesDetails = new ObservableCollection <MatchDetails>(); _ = StartupAsync(); _hubConnection.On <string, string>("ReceiveMatchDetails", (matchID, matchDetailsJson) => { MatchDetails matchDetails = JsonConvert.DeserializeObject <MatchDetails>(matchDetailsJson); UpdateMatchDetails(matchDetails?.Match?.MatchID.ToString(), matchDetails); _dystirDBContext = new DystirDBContext(_dbContextOptions); var fromDate = new DateTime(DateTime.UtcNow.Year, 1, 1); AllMatches = new ObservableCollection <Matches>(_dystirDBContext.Matches .Where(y => y.Time > fromDate && y.MatchActivation != 1 && y.MatchActivation != 2)); new HubSender().SendUpdateCommand(_hubContext, matchID); }); _hubConnection.Closed += DystirHubConnection_Closed; }
public EventsOfMatchesController(IHubContext <DystirHub> hubContext, DystirDBContext dystirDBContext) { if (hubContext != null) { _hubContext = hubContext; } db = dystirDBContext; }
public async Task LoadDataAsync() { _dystirDBContext = new DystirDBContext(_dbContextOptions); var startDystirHubTask = StartDystirHub(); var loadAllMatchesTask = LoadAllMatchesAsync(); var loadAllTeamsTask = LoadAllTeamsAsync(); var loadSponsorsTask = LoadSponsorsAsync(); await Task.WhenAll(startDystirHubTask, loadAllMatchesTask, loadAllTeamsTask, loadSponsorsTask); if (!startDystirHubTask.Result) { Thread.Sleep(1000); await LoadDataAsync(); } HubConnectionConnected(); }
public InfoStandingsController(DystirDBContext dystirDBContext) { db = dystirDBContext; }
public FixturesController(DystirDBContext dystirDBContext) { dbContext = dystirDBContext; }
public PlayersController(DystirDBContext dystirDBContext) { _dystirDBContext = dystirDBContext; }
public StandingsController(DystirDBContext dystirDBContext) { _dbContext = dystirDBContext; }
public SponsorsController(DystirDBContext dystirDBContext) { db = dystirDBContext; }
public EventsOfMatchesController(IHubContext <DystirHub> hubContext, DystirDBContext dystirDBContext) { _hubContext = hubContext; _dystirDBContext = dystirDBContext; }
public StatusesController(DystirDBContext dystirDBContext) { db = dystirDBContext; }
public IEnumerable <CompetitionStatistic> GetCompetitionsStatistic(ObservableCollection <Matches> allMatches, DystirDBContext dystirDBContext) { DateTime date = new DateTime(DateTime.Now.Year, 1, 1); var matchesList = allMatches ?? new ObservableCollection <Matches>(); var playersList = new ObservableCollection <PlayersOfMatches>(dystirDBContext.PlayersOfMatches? .Where(x => x.Goal > 0 || x.Assist > 0).ToList().Where(p => matchesList.Any(m => m.MatchID == p.MatchId))); List <CompetitionStatistic> competitionStatisticsList = new List <CompetitionStatistic>(); var competititionNamesArray = new string[] { "Betri deildin", "1. deild", "Betri deildin kvinnur" }; foreach (string competititionName in competititionNamesArray) { competitionStatisticsList.Add(GetStatistics(allMatches, competititionName, playersList)); } return(competitionStatisticsList); }
public MatchesViewController(DystirDBContext dystirDBContext) { dbContext = dystirDBContext; }
public StatisticsController(DystirDBContext dystirDBContext) { _dystirDBContext = dystirDBContext; }
public SponsorsViewController(DystirDBContext dystirDBContext) { dbContext = dystirDBContext; }
public StatisticsViewController(DystirDBContext dystirDBContext) { db = dystirDBContext; }
public InfoMatchesController(DystirDBContext dystirDBContext) { dbContext = dystirDBContext; }
public AdministratorsController(DystirDBContext dystirDBContext) { _dystirDBContext = dystirDBContext; }
public StandingsViewController(DystirDBContext dystirDBContext) { db = dystirDBContext; }
public MatchTypesController(DystirDBContext dystirDBContext) { db = dystirDBContext; }
public StandingsController(DystirDBContext dystirDBContext, StandingService standingService) { _standingService = standingService; _dystirDBContext = dystirDBContext; }
public RoundsController(DystirDBContext dystirDBContext) { db = dystirDBContext; }
public TeamsController(DystirDBContext dystirDBContext) { _dystirDBContext = dystirDBContext; }
public InfoStatisticsController(DystirDBContext dystirDBContext) { db = dystirDBContext; }
public CategoriesController(DystirDBContext dystirDBContext) { _dystirDBContext = dystirDBContext; }
public SquadsController(DystirDBContext dystirDBContext) { db = dystirDBContext; }
public MatchDetailsController(DystirDBContext dystirDBContext) { dbContext = dystirDBContext; }
public ResultsController(DystirDBContext dystirDBContext) { dbContext = dystirDBContext; }