示例#1
0
        public ActionResult Create()
        {
            CupWinnerViewModel model = new CupWinnerViewModel();

            PopulateStaticData(model);

            return(View(model));
        }
示例#2
0
        public ActionResult Create(CupWinnerViewModel model)
        {
            if (ModelState.IsValid)
            {
                CupWinner leagueWinner = new CupWinner(competitionService.GetCurrentSeason(), cupService.Get(model.CupId), teamService.Get(model.TeamId));

                this.cupWinnerService.Insert(leagueWinner);
                this.cupWinnerService.Commit();

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

            PopulateStaticData(model);

            return(View(model));
        }
示例#3
0
 private void PopulateStaticData(CupWinnerViewModel model)
 {
     model.Teams = teamService.GetTeamsForCurrentSeason().ToSelectList(x => x.ToString(), x => x.Id.ToString(), model.TeamId.ToString());
     model.Cups  = this.cupService.Get(orderBy: q => q.OrderByDescending(s => s.Id)).ToSelectList(x => x.ToString(), x => x.Id.ToString(), model.CupId.ToString());
 }