Example #1
0
        public void Handle(UpdateLeagueInformationsCommand command)
        {
            // TODO validate

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

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

                UpdateLeagueInformations(league, command);
                dbContext.SaveChanges();
            }
        }
Example #2
0
        public ActionResult UpdateInformations(UpdateLeagueInformationsCommand command)
        {
            HandleCommand(command, Json("League data updated"));

            return(RedirectToAction("Index"));
        }
Example #3
0
 private void UpdateLeagueInformations(League league, UpdateLeagueInformationsCommand command)
 {
     league.Name                   = command.Name;
     league.Description            = command.Description;
     league.AdditionalInformations = command.AdditionalInformations;
 }