Ejemplo n.º 1
0
        public void Handle(UpdateTeamStatusCommand 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);

                if (league == null || league.TeamsWaitingForApprove == null)
                {
                    throw new ServerSideException("Ups, something went wrong! Refresh page and try agine");
                }

                if (team == null)
                {
                    throw new ServerSideException("Ups, something went wrong! Refresh page and try agine");
                }

                UpdateTeamStatus(league, team, command.Accept);
                dbContext.SaveChanges();
            }
        }
Ejemplo n.º 2
0
        public ActionResult UpdateStatus(UpdateTeamStatusCommand command)
        {
            HandleCommand(command, Json("League status changed"));

            return(RedirectToAction("Index"));
        }