public void Handle(EditPlayerCommand command)
        {
            var player = uow.Players.GetById(command.ID);

            player.Name        = command.Name;
            player.PhoneNumber = command.PhoneNumber;
            player.Team        = command.TeamID != Constants.Invalid_Id ? uow.Teams.GetById(command.TeamID) : null;

            uow.SaveChanges();
        }
Exemple #2
0
        public void Handle(AddPlayerCommand command)
        {
            uow.Players.AddObject(new Players
            {
                Name        = command.Name,
                PhoneNumber = command.PhoneNumber,
                Team        = command.TeamID != Constants.Invalid_Id ? uow.Teams.GetById(command.TeamID) : null,
            });

            uow.SaveChanges();
        }
Exemple #3
0
        public void Handle(EditCoachCommand command)
        {
            var coach = uow.Coaches.GetById(command.ID);

            coach.Name        = command.Name;
            coach.Email       = command.Email;
            coach.PhoneNumber = command.PhoneNumber;
            coach.Team        = command.TeamID != Constants.Invalid_Id ? uow.Teams.GetById(command.TeamID) : null;

            uow.SaveChanges();
        }
Exemple #4
0
        public void Handle(AddCoachCommand command)
        {
            uow.Coaches.AddObject(new Coaches
            {
                Name        = command.Name,
                Email       = command.Email,
                PhoneNumber = command.PhoneNumber,
                Team        = command.TeamID != Constants.Invalid_Id ? uow.Teams.GetById(command.TeamID) : null,
            });

            uow.SaveChanges();
        }
Exemple #5
0
        public void Handle(EditTeamCommand command)
        {
            var team = uow.Teams.GetById(command.ID);

            team.Season        = (int)command.Season;
            team.Category      = (int)command.Category;
            team.Name          = command.Name;
            team.TrainingDay1  = (int)command.TrainingDay1;
            team.TrainingTime1 = command.TrainingTime1;
            team.TrainingDay2  = (int?)command.TrainingDay2;
            team.TrainingTime2 = command.TrainingDay2 == null ? null : command.TrainingTime2;

            uow.SaveChanges();
        }
Exemple #6
0
        public void Handle(AddTeamCommand command)
        {
            uow.Teams.AddObject(new Teams
            {
                Season        = (int)command.Season,
                Category      = (int)command.Category,
                Name          = command.Name,
                TrainingDay1  = (int)command.TrainingDay1,
                TrainingTime1 = command.TrainingTime1,
                TrainingDay2  = (int?)command.TrainingDay2,
                TrainingTime2 = command.TrainingDay2 == null ? null : command.TrainingTime2
            });

            uow.SaveChanges();
        }
        public AuthTokenDto Register(RegistrationDataDto registerData)
        {
            var user = new UserDataModel
            {
                UserName = registerData.UserName,
                Password = registerData.Password,
                //MoneyBalance = registerData.MoneyBalance
            };

            data.UserRepository.Add(user);
            data.SaveChanges();

            var loginData = new LogInDataDto
            {
                Username = registerData.UserName,
                Password = registerData.Password
            };

            var token = authenticationTokenService.CreateToken(loginData);

            return(token);
        }
Exemple #8
0
        public void Handle(DeletePlayerCommand command)
        {
            uow.Players.DeleteObject(uow.Players.GetById(command.ID));

            uow.SaveChanges();
        }
Exemple #9
0
        public void Handle(DeleteTeamCommand command)
        {
            uow.Teams.DeleteObject(uow.Teams.GetById(command.ID));

            uow.SaveChanges();
        }
Exemple #10
0
        public void Handle(DeleteCoachCommand command)
        {
            uow.Coaches.DeleteObject(uow.Coaches.GetById(command.ID));

            uow.SaveChanges();
        }