Ejemplo n.º 1
0
        public string DeleteTeam(int teamId)
        {
            string result = "Failed";

            {
                Teams team = teamRepository.SingleOrDefault(x => x.teamId == teamId);
                if (team != null)
                {
                    List <PlayerDomainModel> teamPlayers = getPlayers(teamId);
                    var arr = teamPlayers.ToArray();
                    for (int i = 0; i < arr.Length; i++)
                    {
                        int temp  = arr[i].skill;
                        int temp2 = arr[i].playerId;
                        //var playerSkill = playerSkillRepository.SingleOrDefault(x => x.id == temp);
                        //int skillId = playerSkill.id;
                        playerRepository.Delete(x => x.playerId == temp2);
                        playerSkillRepository.Delete(x => x.id == temp);
                    }
                    teamRepository.Delete(x => x.teamId == teamId);

                    result = "Deleted";
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
        public string DeletePlayer(int pId)
        {
            string result = "Failed";

            //if (dm.playerId > 0)
            {
                Players player = playerRepository.SingleOrDefault(x => x.playerId == pId);

                if (player != null)
                {
                    var playerSkill = playerSkillRepository.SingleOrDefault(x => x.id == player.skill);
                    int skillId     = playerSkill.id;
                    playerRepository.Delete(x => x.playerId == pId);
                    playerSkillRepository.Delete(x => x.id == skillId);

                    result = "Deleted";
                }
            }

            return(result);
        }