Beispiel #1
0
        public ActionResult Create(LeagueWinnerViewModel model)
        {
            if (ModelState.IsValid)
            {
                LeagueWinner leagueWinner = new LeagueWinner(leagueService.Get(model.LeagueId), teamService.Get(model.TeamId));

                leagueWinnerService.Insert(leagueWinner);
                leagueWinnerService.Commit();

                SuccessMessage(FormMessages.SaveSuccess);
                return(RedirectToAction("Index"));
            }

            PopulateStaticData(model);

            return(View(model));
        }
        public ActionResult Create(PenaltyViewModel model)
        {
            if (ModelState.IsValid)
            {
                model.Penalty.League = leagueService.Get(model.LeagueId);
                model.Penalty.Team   = teamService.Get(model.TeamId);

                penaltyService.Save(model.Penalty);
                penaltyService.Commit(); // Seems to have to be committed before updating points/stats

                UpdateTeamLeaguePenaltiesAndStats(model.LeagueId, model.TeamId);

                penaltyService.Commit();

                SuccessMessage(FormMessages.SaveSuccess);

                return(RedirectToAction("Index"));
            }

            PopulateStaticData(model);

            return(View(model));
        }
        public async Task <IActionResult> Get(Guid id)
        {
            IActionResult result = await Execute(_log, async() => await _leagueService.Get(id));

            return(result);
        }
Beispiel #4
0
        public ActionResult Index()
        {
            List <League> leagueList = leagueService.Get(orderBy: q => q.OrderByDescending(l => l.Id));

            return(View(leagueList));
        }
Beispiel #5
0
        public ActionResult View(int id)
        {
            League @league = leagueService.Get(id);

            return(View(@league));
        }