Exemplo n.º 1
0
        public Participant UpdateParticipant([FromBody] Participant participant)
        {
            var participantToUpdate = ParticipantConverter.ConvertDtoToModel(participant);

            _participantService.UpdateParticipant(participantToUpdate);
            return(ParticipantConverter.ConvertModelToDto(participantToUpdate));
        }
Exemplo n.º 2
0
        public Participant AddParticipant([FromBody] Participant participant)
        {
            var participantToAdd = ParticipantConverter.ConvertDtoToModel(participant);
            var newParticipant   = _participantService.AddParticipant(participantToAdd);

            return(ParticipantConverter.ConvertModelToDto(newParticipant));
        }
        public async Task <UserDto> GetUserByIdAsync(Guid id)
        {
            UserDto user = UserConverter.Convert(await _userRepo.GetByIdAsync(id));

            user.Administration = AdministrationConverter.Convert(await _adminRepo.GetByUserIdAsync(id));
            user.Participant    = ParticipantConverter.Convert(await _participantRepo.GetByUserIdAsync(id));
            return(user);
        }
        public async Task <GroupDto> GetGroupByIdAsync(Guid id)
        {
            GroupDto group = GroupConverter.Convert(await _groupRepo.GetByIdAsync(id));

            group.CourseName  = _courseRepo.GetByIdAsync(group.CourseId).Result.Name;
            group.Participant = ParticipantConverter.Convert(await _participantRepo.GetByGroupIdAsync(id));
            return(group);
        }
Exemplo n.º 5
0
        public async Task <ParticipantDto> GetParticipantByIdAsync(Guid userId, Guid groupId)
        {
            ParticipantDto participant = ParticipantConverter.Convert(await _participantRepo.GetByIdAsync(userId, groupId));

            participant.GroupName = _groupRepo.GetByIdAsync(participant.GroupId).Result.Name;
            participant.RoleName  = _participantRoleRepo.GetByIdAsync(participant.ParticipantRoleId).Result.Name;
            participant.UserName  = _userRepo.GetByIdAsync(participant.UserId).Result.Name;
            return(participant);
        }
Exemplo n.º 6
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="propToValueMap"></param>
    /// <returns></returns>
    public static MatchDetail DictionaryToMatchDetail(Dictionary <String, Object> propToValueMap)
    {
        MatchDetail matchDetail = new MatchDetail();

        #region MapId Property

        if (propToValueMap.ContainsKey(MatchDetail.PropertyNames.MapId) && propToValueMap[MatchDetail.PropertyNames.MapId] is int)
        {
            matchDetail.MapId = (int)propToValueMap[MatchDetail.PropertyNames.MapId];
        }

        #endregion

        #region MatchCreation Property

        if (propToValueMap.ContainsKey(MatchDetail.PropertyNames.MatchCreation) && propToValueMap[MatchDetail.PropertyNames.MatchCreation] is long)
        {
            matchDetail.MatchCreation = (long)propToValueMap[MatchDetail.PropertyNames.MatchCreation];
        }

        #endregion

        #region MatchDuration Property

        if (propToValueMap.ContainsKey(MatchDetail.PropertyNames.MatchDuration) && propToValueMap[MatchDetail.PropertyNames.MatchDuration] is int)
        {
            matchDetail.MatchDuration = (int)propToValueMap[MatchDetail.PropertyNames.MatchDuration];
        }

        else if (propToValueMap.ContainsKey(MatchDetail.PropertyNames.MatchDuration) && propToValueMap[MatchDetail.PropertyNames.MatchDuration] is long)
        {
            matchDetail.MatchDuration = (long)propToValueMap[MatchDetail.PropertyNames.MatchDuration];
        }

        #endregion

        #region MatchId Property

        if (propToValueMap.ContainsKey(MatchDetail.PropertyNames.MatchId) && propToValueMap[MatchDetail.PropertyNames.MatchId] is int)
        {
            matchDetail.MatchId = (int)propToValueMap[MatchDetail.PropertyNames.MatchId];
        }

        else if (propToValueMap.ContainsKey(MatchDetail.PropertyNames.MatchId) && propToValueMap[MatchDetail.PropertyNames.MatchId] is long)
        {
            matchDetail.MatchId = (long)propToValueMap[MatchDetail.PropertyNames.MatchId];
        }

        #endregion

        #region MatchMode Property

        if (propToValueMap.ContainsKey(MatchDetail.PropertyNames.MatchMode) && propToValueMap[MatchDetail.PropertyNames.MatchMode] is String)
        {
            matchDetail.MatchMode = (String)propToValueMap[MatchDetail.PropertyNames.MatchMode];
        }

        #endregion

        #region MatchType Property

        if (propToValueMap.ContainsKey(MatchDetail.PropertyNames.MatchType) && propToValueMap[MatchDetail.PropertyNames.MatchType] is String)
        {
            matchDetail.MatchType = (String)propToValueMap[MatchDetail.PropertyNames.MatchType];
        }

        #endregion

        #region MatchVersion Property

        if (propToValueMap.ContainsKey(MatchDetail.PropertyNames.MatchVersion) && propToValueMap[MatchDetail.PropertyNames.MatchVersion] is String)
        {
            matchDetail.MatchVersion = (String)propToValueMap[MatchDetail.PropertyNames.MatchVersion];
        }

        #endregion

        #region ParticipantIdentities Property !!!!!!!!!(Not yet implemented)!!!!!!!!!!!!!

        if (propToValueMap.ContainsKey(MatchDetail.PropertyNames.ParticipantIdentities) && propToValueMap[MatchDetail.PropertyNames.ParticipantIdentities] is Dictionary <string, Object>[])
        {
            Dictionary <String, Object>[] participantIdentitiesPropValueMaps = (Dictionary <String, Object>[])propToValueMap[MatchDetail.PropertyNames.ParticipantIdentities];

            if (participantIdentitiesPropValueMaps.Length > 0)
            {
                ParticipantIdentity[] participantIdentities = new ParticipantIdentity[participantIdentitiesPropValueMaps.Length];

                for (int mapIndex = 0; mapIndex < participantIdentitiesPropValueMaps.Length; ++mapIndex)
                {
                    Dictionary <String, Object> participantIdentitiesPropValueMap = participantIdentitiesPropValueMaps[mapIndex];
                    ParticipantIdentity         participantIdentity = ParticipantIdentityConverter.DictionaryToParticipantIdentity(participantIdentitiesPropValueMap);
                    participantIdentities[mapIndex] = participantIdentity;
                }

                matchDetail.ParticipantIdentities = participantIdentities;
            }
        }

        #endregion

        #region Participants Property

        if (propToValueMap.ContainsKey(MatchDetail.PropertyNames.Participants) && propToValueMap[MatchDetail.PropertyNames.Participants] is Dictionary <string, object>[])
        {
            Dictionary <String, Object>[] participantPropValueMaps = (Dictionary <String, Object>[])propToValueMap[MatchDetail.PropertyNames.Participants];

            if (participantPropValueMaps.Length > 0)
            {
                Participant[] participants = new Participant[participantPropValueMaps.Length];

                for (int mapIndex = 0; mapIndex < participantPropValueMaps.Length; ++mapIndex)
                {
                    Dictionary <String, Object> participantPropValueMap = participantPropValueMaps[mapIndex];
                    Participant participant = ParticipantConverter.DictionaryToParticipant(participantPropValueMap);
                    participants[mapIndex] = participant;
                }

                matchDetail.Participants = participants;
            }
        }

        #endregion

        #region PlatformId Property

        if (propToValueMap.ContainsKey(MatchDetail.PropertyNames.PlatformId) && propToValueMap[MatchDetail.PropertyNames.PlatformId] is String)
        {
            matchDetail.PlatformId = (String)propToValueMap[MatchDetail.PropertyNames.PlatformId];
        }

        #endregion

        #region QueueType Property

        if (propToValueMap.ContainsKey(MatchDetail.PropertyNames.QueueType) && propToValueMap[MatchDetail.PropertyNames.QueueType] is String)
        {
            matchDetail.QueueType = (String)propToValueMap[MatchDetail.PropertyNames.QueueType];
        }

        #endregion

        #region Region Property

        if (propToValueMap.ContainsKey(MatchDetail.PropertyNames.Region) && propToValueMap[MatchDetail.PropertyNames.Region] is String)
        {
            matchDetail.Region = (String)propToValueMap[MatchDetail.PropertyNames.Region];
        }

        #endregion

        #region Season Property

        if (propToValueMap.ContainsKey(MatchDetail.PropertyNames.Season) && propToValueMap[MatchDetail.PropertyNames.Season] is String)
        {
            matchDetail.Season = (String)propToValueMap[MatchDetail.PropertyNames.Season];
        }

        #endregion

        #region Teams Property !!!!!!!!!(Not Yet IMPLEMENTED)!!!!!!!!!!!!!!!!

        /* if (propToValueMap.ContainsKey(MatchDetail.PropertyNames.Teams) && propToValueMap[MatchDetail.PropertyNames.Teams] is String)
         * {
         *  matchDetail.Teams = (String)propToValueMap[MatchDetail.PropertyNames.Teams];
         * }*/

        #endregion

        #region Timeline Property !!!!!!!!!(Not Yet IMPLEMENTED)!!!!!!!!!!!!!!!!

        /*if (propToValueMap.ContainsKey(MatchDetail.PropertyNames.Timeline) && propToValueMap[MatchDetail.PropertyNames.Timeline] is String)
         * {
         *  matchDetail.Timeline = (String)propToValueMap[MatchDetail.PropertyNames.Timeline];
         * }*/

        #endregion

        return(matchDetail);
    }
Exemplo n.º 7
0
 public async Task <bool> UpdateParticipantAsync(ParticipantDto item)
 {
     return(await _participantRepo.UpdateAsync(ParticipantConverter.Convert(item)));
 }
Exemplo n.º 8
0
 public async Task <ParticipantDto> CreateParticipantAsync(ParticipantDto item)
 {
     return(ParticipantConverter.Convert(await _participantRepo.CreateAsync(ParticipantConverter.Convert(item))));
 }
Exemplo n.º 9
0
 public async Task <List <ParticipantDto> > GetParticipantByRoleIdAsync(Guid id)
 {
     return(ParticipantConverter.Convert(await _participantRepo.GetByRoleIdAsync(id)));
 }
Exemplo n.º 10
0
 public async Task <List <ParticipantDto> > GetAllParticipantAsync()
 {
     return(ParticipantConverter.Convert(await _participantRepo.GetAllAsync()));
 }
Exemplo n.º 11
0
        public IEnumerable <Participant> GetAllAvailableParticipants()
        {
            var allAvailableParticipants = _participantService.LoadAllAvailableParticipants();

            return(ParticipantConverter.ConvertModelToDto(allAvailableParticipants));
        }