public async Task <IActionResult> AllMatches() { var allMatches = await this.matchesService.GetAllMatchesAsync(); var matchesForView = new List <MatchViewModel>(); foreach (var match in allMatches) { var matchForView = new MatchViewModel { MatchId = match.Id, FirstTeamName = match.MatchTeams.ToArray()[0].Team.Name, SecondTeamName = match.MatchTeams.ToArray()[1].Team.Name, StartingTime = match.StartingTime, FirstTeamOdds = match.FirstTeamToWinOdds.ToString("f2"), DrawOdds = match.DrawOdds.ToString("f2"), SecondTeamOdds = match.SecondTeamToWinOdds.ToString("f2"), Result = match.Result }; matchesForView.Add(matchForView); } var matchesViewModel = new MatchesViewModel() { matches = matchesForView.OrderByDescending(m => m.StartingTime).ToList() }; return(this.View(matchesViewModel)); }
public EventSelectedPage(MatchesViewModel viewModel, string matchEventName, EventOfMatch eventOfMatch) { InitializeComponent(); _viewModel = viewModel; _eventOfMatch = eventOfMatch; _eventText = ""; _teamName = eventOfMatch?.EventTeam ?? string.Empty; _matchEventName = matchEventName; _selectedMatch = viewModel.SelectedLiveMatch; _isUpdateEvent = _eventOfMatch != null; _isConfirmChanges = false; if (_isUpdateEvent) { _previousTotalTime = _eventOfMatch.EventTotalTime; _previousPeriodID = _eventOfMatch.EventPeriodID; _previousMainPlayerID = _eventOfMatch.MainPlayerOfMatchID; _previousSecondPlayerID = _eventOfMatch.SecondPlayerOfMatchID; if (_matchEventName?.ToUpper().Trim() == "CORNER") { _playersList = new List <PlayerOfMatch>(); } } else { _eventOfMatch = new EventOfMatch() { EventTotalTime = new TotalTimeFromSelectedMatchTimeConverter()?.Convert(_selectedMatch, null, null, CultureInfo.CurrentCulture)?.ToString(), EventPeriodID = (int)_selectedMatch.StatusID }; DeleteEventView.IsVisible = false; } BindingContext = _viewModel.SelectedLiveMatch; }
public LogInPage(MatchesViewModel viewModel) { InitializeComponent(); _viewModel = viewModel; LoadingView.IsVisible = false; LogInView.IsVisible = true; }
//Postman link: https://localhost:5001/Home/Matches public IActionResult Matches() { var dbMatches = _matchService.GetMatches(); var matches = new List <TicketViewModel>(); foreach (var ticket in dbMatches) { var tempMatch = new TicketViewModel() { MatchName = ticket.MatchName, Price = ticket.Price, Sector = ticket.Sector }; matches.Add(tempMatch); } var matchesViewModel = new MatchesViewModel() { Matches = matches, }; return(View(matchesViewModel)); }
public MatchesPage() { InitializeComponent(); BindingContext = viewModel = new MatchesViewModel(); MatchesListView.ItemSelected += MatchesListView_ItemSelected; }
public EditOpponentScorePage(MatchesViewModel matchesViewModel) { InitializeComponent(); matchesViewModel.NewGoal = new Goal(); Title = "Gól " + matchesViewModel.SelectedMatch.OpponentName; BindingContext = matchesViewModel; }
public IActionResult SearchTeam(string name, int numberOfMatches) { this.ViewBag.Team = name; var foundTeam = new MatchesViewModel { Matches = this.matchService.SearchTeam <MatchViewModel>(name, numberOfMatches), }; this.ViewBag.HomeWins = foundTeam.Matches.Where(x => x.HomeTeam == name && x.HomeTeamResult > x.AwayTeamResult).Count(); this.ViewBag.AwayWins = foundTeam.Matches.Where(x => x.AwayTeam == name && x.HomeTeamResult < x.AwayTeamResult).Count(); this.ViewBag.Draw = foundTeam.Matches.Where(x => x.HomeTeamResult == x.AwayTeamResult).Count(); this.ViewBag.HomeLoose = foundTeam.Matches.Where(x => x.HomeTeam == name && x.HomeTeamResult < x.AwayTeamResult).Count(); this.ViewBag.AwayLoose = foundTeam.Matches.Where(x => x.AwayTeam == name && x.HomeTeamResult > x.AwayTeamResult).Count(); var test = 0; foreach (var item in foundTeam.Matches) { test += item.AwayTeamResult; } if (numberOfMatches != 0) { this.ViewBag.AwayTeamGoals = test / numberOfMatches; } return(this.View(foundTeam)); }
private async Task LoadSelectedMatchDataAsync(MatchesViewModel viewModel) { await viewModel.GetSelectedLiveMatch(viewModel.SelectedLiveMatch); viewModel.TimeCounter.MatchesTime(viewModel, new ObservableCollection <Match>()); viewModel.IsLoadingSelectedMatch = false; }
public ActionResult <object> Post([FromBody] MatchesViewModel user) { if (user == null) { var toSerialize = new MessageHelpers <MatchesViewModel>() { Status = 404, Data = null }; return(JsonConvert.SerializeObject(toSerialize)); } else { try { var id = _matchesServiceAsync.Add(user); var toSerialize = new MessageHelpers <MatchesViewModel>() { Status = 200, Data = null }; return(JsonConvert.SerializeObject(toSerialize)); } catch { var toSerialize = new MessageHelpers <MatchesViewModel>() { Status = 502, Data = null }; return(JsonConvert.SerializeObject(toSerialize)); } } }
public MatchPage(MatchesViewModel matchesViewModel) { InitializeComponent(); matchesViewModel.Navigation = this.Navigation; BindingContext = matchesViewModel; SetAddGoalBtnsVisibility(); SetEditDeleteMatchVisibility(); }
private async void RefreshAllData(MatchesViewModel viewModel) { if (viewModel != null) { viewModel.IsLoading = true; } await(Application.Current as App).ReloadAsync(LoadDataType.MainData); }
public ActionResult CreateMatch(int competitionId) { var matchModel = new MatchesViewModel { CompetitionId = competitionId }; return(View(matchModel)); }
public MatchesPage(MatchesViewModel viewModel) { InitializeComponent(); _viewModel = viewModel; _viewModel.PropertyChanged += _viewModel_PropertyChanged; BindingContext = _viewModel; Populate(); }
public SetLineUpsPage(MatchesViewModel viewModel) { _viewModel = viewModel; InitializeComponent(); BindingContext = viewModel.SelectedLiveMatch; AddDetailsMenuItemView(); ShowSelectedDetailsTab(); }
public LineUpsPage(MatchesViewModel viewModel, string teamName) { InitializeComponent(); _viewModel = viewModel; _teamName = teamName; Title = teamName; BindingContext = _viewModel; }
public EventsOfMatchPage(MatchesViewModel viewModel) { InitializeComponent(); _viewModel = viewModel; BindingContext = _viewModel; LoadMatchData(); PopulateMatchTime(); }
public DystirPage(MatchesViewModel viewModel) { _viewModel = viewModel; _viewModel.PageTitle = Properties.Resources.Matches; Analytics.TrackEvent("Matches"); InitializeComponent(); BindingContext = _viewModel; AddViews(_viewModel); }
public ManagerPickerPage(MatchesViewModel viewModel, Match match, Label mainManagerLabel) { InitializeComponent(); _viewModel = viewModel; ValueLabel = mainManagerLabel; SelectedValue = ValueLabel.Text; Populate(viewModel, match); BindingContext = this; }
public FixturesPage(MatchesViewModel viewModel) { _viewModel = viewModel; InitializeComponent(); BindingContext = viewModel; Title = Properties.Resources.Fixtures; AddMenuView(); PopulateView(_viewModel); }
public void ReloadSelectedMatches(MatchesViewModel viewModel, bool refreshSelectedMatch) { _viewModel = viewModel; BindingContext = viewModel; if (refreshSelectedMatch) { _ = LoadSelectedMatchDataAsync(viewModel); } }
public IActionResult Football() { var findedMatch = new MatchesViewModel { Matches = this.matchService.GetAllMatches <MatchViewModel>(), }; return(this.View(findedMatch)); }
public SelectedPlayerPage(PlayerOfMatch playerOfMatch, MatchesViewModel viewModel, ListView playingListView) { InitializeComponent(); _playerOfMatch = playerOfMatch; _viewModel = viewModel; PlayingListView = playingListView; Title = _playerOfMatch?.FirstName + " " + _playerOfMatch?.LastName; BindingContext = _playerOfMatch; }
public AddMatchPage(MatchesViewModel matchesViewModel = null) { InitializeComponent(); if (matchesViewModel == null) { matchesViewModel = new MatchesViewModel(); } matchesViewModel.Navigation = this.Navigation; BindingContext = matchesViewModel; }
public Matches CreateMatchEntity(MatchesViewModel model) { return(new Matches { HomeTeamId = model.HomeId, AwayTeamId = model.AwayId, StartTime = model.StartTime, CompetitionId = model.CompetitionId }); }
public SelectedMatchDetailsView(MatchesViewModel viewModel) { _viewModel = viewModel; _viewModel.IsLoadingSelectedMatch = !_viewModel.IsDisconnected; InitializeComponent(); BindingContext = viewModel; AddDetailsMenuItemView(); ShowSelectedDetailsTab(); _ = LoadSelectedMatchDataAsync(_viewModel); }
public UpdateAndNewMatchPage(MatchesViewModel viewModel, TypePages typePreviousPage) { _viewModel = viewModel; _typeOfPage = typePreviousPage; _viewModel.SetMatchAdditionalDetails(); InitializeComponent(); BindingContext = _viewModel.SelectedLiveMatch; SetPageButtonsAndTitle(typePreviousPage); CreateMatchActionButtons(); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null) { return(value); } MatchesViewModel viewModel = value as MatchesViewModel; var fullPlayerList = viewModel.SelectedLiveMatch?.PlayersOfMatch?.Where(y => y.TeamName == viewModel?.SelectedLiveMatch.SelectedTeam); return(new ObservableCollection <IGrouping <int?, PlayerOfMatch> >(fullPlayerList.GroupBy(x => x.PlayingStatus))); }
public IActionResult Index(int round = 1) { var model = new MatchesViewModel(); model.Matches = matchesRepository.GetRoundMathes(round); model.RoundSelectList = Constants.Round.Select(x => new SelectListItem { Value = x.ToString(), Text = x.ToString() }).ToList(); model.SelectedRound = round; return(View(model)); }
public ActionResult matches() { MatchesViewModel viewModel = new MatchesViewModel(); List <MatchViewModel> modelMatches = GetMatches(); viewModel.matches = modelMatches; viewModel.ArenaList = dbContext.Arenas.ToList(); viewModel.TeamList = dbContext.Teams.ToList(); return(View(viewModel)); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value != null && parameter != null) { View layout = (View)parameter; MatchesViewModel viewModel = layout.BindingContext as MatchesViewModel; var allPlayers = value as ObservableCollection <PlayerOfMatch>; var playersByTeam = allPlayers?.Where(x => x.TeamName?.ToUpper().Trim() == viewModel?.SelectedLiveMatch?.SelectedTeam?.ToUpper().Trim())?.ToList(); return(playersByTeam); } return(value); }