Esempio n. 1
0
        public ActionResult Index(string season_Id, LeagueDetailsViewModel model, FormCollection collection)
        {
            List <ListOfMatch> _listOfAllMatche;
            MatchProcessor     _matchProcessor = new MatchProcessor();

            _listOfAllMatche = _matchProcessor.RetrieveListOfAllMatch();

            model.result     = new List <FixtureResultViewModel>();
            model.clubStatus = new List <LeagueClubDetailsViewModel>();

            string leagueID  = collection["ligaID"].ToString();
            string seasonId  = collection["sezonaID"].ToString();
            string fixtureId = collection["koloID"].ToString();

            foreach (ListOfMatch _lom in _listOfAllMatche)
            {
                if (_lom.Season_Id.ToString() == seasonId && _lom.Competition_Id.ToString() == leagueID &&
                    _lom.Fixture_Id.ToString() == fixtureId && _lom.Type == 1)
                {
                    FixtureResultViewModel rlvm = new FixtureResultViewModel();
                    rlvm.matchId    = _lom.Id;
                    rlvm.guestClub  = _lom.HomeName;
                    rlvm.guestGoals = _lom.SecondOrgScore;
                    rlvm.homeGoals  = _lom.FirstOrgScore;
                    rlvm.homeClub   = _lom.GuestName;

                    model.result.Add(rlvm);
                }

                if (_lom.Type == 1)
                {
                    if (!leagues.Exists(x => x.Value == _lom.Competition_Id.ToString()))
                    {
                        leagues.Add(new SelectListItem {
                            Text = _lom.CompetitionName, Value = _lom.Competition_Id.ToString()
                        });
                    }
                    if (!seasons.Exists(x => x.Value == _lom.Season_Id.ToString()))
                    {
                        seasons.Add(new SelectListItem {
                            Text = _lom.SeasonName, Value = _lom.Season_Id.ToString()
                        });
                    }
                    if (!fixtures.Exists(x => x.Value == _lom.Fixture_Id.ToString()))
                    {
                        fixtures.Add(new SelectListItem {
                            Text = _lom.FixtureName, Value = _lom.Fixture_Id.ToString()
                        });
                    }
                }
            }

            ViewBag.sezonaID = seasons;
            ViewBag.koloID   = fixtures;
            ViewBag.ligaID   = leagues;

            return(View(model));
        }
Esempio n. 2
0
        // GET: League
        public ActionResult Index()
        {
            List <ListOfMatch> _listOfAllMatche;

            MatchProcessor _matchProcessor = new MatchProcessor();

            _listOfAllMatche = _matchProcessor.RetrieveListOfAllMatch();


            foreach (ListOfMatch _lom in _listOfAllMatche)
            {
                if (_lom.Type == 1)
                {
                    if (!leagues.Exists(x => x.Value == _lom.Competition_Id.ToString()))
                    {
                        leagues.Add(new SelectListItem {
                            Text = _lom.CompetitionName, Value = _lom.Competition_Id.ToString()
                        });
                    }
                    if (!seasons.Exists(x => x.Value == _lom.Season_Id.ToString()))
                    {
                        seasons.Add(new SelectListItem {
                            Text = _lom.SeasonName, Value = _lom.Season_Id.ToString()
                        });
                    }
                    if (!fixtures.Exists(x => x.Value == _lom.Fixture_Id.ToString()))
                    {
                        fixtures.Add(new SelectListItem {
                            Text = _lom.FixtureName, Value = _lom.Fixture_Id.ToString()
                        });
                    }
                }
            }

            ViewBag.sezonaID = seasons;
            ViewBag.koloID   = fixtures;
            ViewBag.ligaID   = leagues;


            return(View());
        }