Ejemplo n.º 1
0
        public void Handle(JoinLeagueCommand command)
        {
            // TODO validate

            using (var dbContext = new ManagementDataContext())
            {
                League league = dbContext.Leagues.SingleOrDefault(l => l.Id == command.LeagueId);
                Team   team   = dbContext.Teams.SingleOrDefault(l => l.Id == command.TeamId);

                JoinToLeague(league, team);

                dbContext.SaveChanges();
            }
        }
        public ActionResult JoinLeague(JoinLeagueCommand command)
        {
            HandleCommand(command, Json("Team joined to league"));

            return(RedirectToAction("Index"));
        }