Ejemplo n.º 1
0
        public virtual ActionResult Create(long seasonId, long leagueId)
        {
            var model = new MatchDayViewModel();

            model.SeasonId = seasonId;
            model.LeagueId = leagueId;
            return(View(model));
        }
Ejemplo n.º 2
0
        public virtual ActionResult Edit(MatchDayViewModel model)
        {
            if (ModelState.IsValid)
            {
                var matchDay = _matchDayService.GetById(model.MatchDayId);
                matchDay.Number = model.Number;
                matchDay.Round  = model.Round;

                _matchDayService.Update(matchDay);

                return(RedirectToAction(MVC.Admin.MatchDays.List(model.SeasonId, model.LeagueId)));
            }
            return(View(model));
        }
Ejemplo n.º 3
0
        public virtual ActionResult Create(MatchDayViewModel model)
        {
            if (ModelState.IsValid)
            {
                var matchDay = new MatchDay()
                {
                    LeagueId = model.LeagueId,
                    SeasonId = model.SeasonId,
                    Number   = model.Number,
                    Round    = model.Round
                };

                _matchDayService.Create(matchDay);

                return(RedirectToAction(MVC.Admin.MatchDays.List(model.SeasonId, model.LeagueId)));
            }

            return(View(model));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> List(MatchDayViewModel matchDayViewModel)
        {
            var matches = await this._matchService
                          .GetMatchesAsync(matchDayViewModel.MatchDay);

            ICollection <MatchViewModel> matchesViewModel = new List <MatchViewModel>();

            foreach (var match in matches)
            {
                matchesViewModel.Add(new MatchViewModel
                {
                    Id        = match.Id,
                    HomeTeam  = match.HomeTeam,
                    AwayTeam  = match.AwayTeam,
                    HomeGoals = match.HomeGoals,
                    AwayGoals = match.AwayGoals,
                    MatchDay  = match.MatchDay
                });
            }

            return(View(matchesViewModel));
        }
Ejemplo n.º 5
0
        public virtual ActionResult DeleteConfirmed(MatchDayViewModel model)
        {
            _matchDayService.Delete(model.MatchDayId);

            return(RedirectToAction(MVC.Admin.MatchDays.List(model.SeasonId, model.LeagueId)));
        }