public ActionResult Create(League @league) { if (ModelState.IsValid) { leagueService.Insert(@league); leagueService.Commit(); SuccessMessage(FormMessages.SaveSuccess); return(RedirectToAction("Index")); } return(View(@league)); }
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)); }