Ejemplo n.º 1
0
        private void UpdateFromModel(Model.Models.Tournament tournament)
        {
            //Set values
            _name        = tournament.Name;
            _startDate   = tournament.StartTime ?? DateTime.Now;
            _description = tournament.Description;
            _maximumMatchDururationInMinutes = tournament.MatchDuration ?? 30;
            _teamCount = Model.TeamCount ?? 16;

            //Raise property changed for values
            RaisePropertyChanged(() => Name);
            RaisePropertyChanged(() => Description);
            RaisePropertyChanged(() => MaximumMatchDurationInMinutes);
            RaisePropertyChanged(() => TeamCount);

            //Raise property changed for calculated values
            RaisePropertyChanged(() => StartDate);
            RaisePropertyChanged(() => StartTime);
            RaisePropertyChanged(() => State);
            RaisePropertyChanged(() => FinalMatch);
            RaisePropertyChanged(() => Matches);
            RaisePropertyChanged(() => HasChanges);
            RaisePropertyChanged(() => TournamentEditable);

            //Raise property changed for commands
            SaveChangesCommand.RaiseCanExecuteChanged();
            StartCommand.RaiseCanExecuteChanged();
            AddTeamCommand.RaiseCanExecuteChanged();
            RemoveTeamCommand.RaiseCanExecuteChanged();
            AddPlayAreaCommand.RaiseCanExecuteChanged();
            RemovePlayAreaCommand.RaiseCanExecuteChanged();
            GenerateWinnerCertificatesCommand.RaiseCanExecuteChanged();
        }
Ejemplo n.º 2
0
        public void Handle(RemoveTeamCommand command)
        {
            // TODO validate

            using (var dbContext = new ManagementDataContext())
            {
                Team team = dbContext.Teams.SingleOrDefault(l => l.ManagerId == command.Id);

                dbContext.Teams.Remove(team);
                dbContext.SaveChanges();
            }
        }
        public ActionResult Remove(RemoveTeamCommand command)
        {
            HandleCommand(command, Json("Team removed"));

            return(RedirectToAction("Index"));
        }