예제 #1
0
 public ActionResult Create(League @league)
 {
     if (ModelState.IsValid)
     {
         leagueService.Insert(@league);
         leagueService.Commit();
         SuccessMessage(FormMessages.SaveSuccess);
         return(RedirectToAction("Index"));
     }
     return(View(@league));
 }
예제 #2
0
        public ActionResult Create(LeagueViewModel model)
        {
            if (ModelState.IsValid)
            {
                // TODO Refactor at some point
                model.League.Season = competitionService.GetSeasons(s => s.Id == model.SeasonId)[0];
                leagueService.Insert(model.League);
                leagueService.Commit();
                SuccessMessage(FormMessages.SaveSuccess);
                return(RedirectToAction("Index"));
            }

            PopulateStaticData(model);

            return(View(model));
        }