public CreateAthleteTestParticipant FetchTestParticipantById(long id)
        {
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }

            //Apply Business Validation(if any)

            //Mapping

            var athleteTestParticipant = _athleteTestParticipantsRepo.Get(id);

            if (athleteTestParticipant != default(TestParticipant))
            {
                _createAthleteTestParticipant = new CreateAthleteTestParticipant()
                {
                    Id              = athleteTestParticipant.Id,
                    UserId          = athleteTestParticipant.UserId,
                    AddedDate       = athleteTestParticipant.AddedDate,
                    ModifiedDate    = athleteTestParticipant.ModifiedDate,
                    AthleteTest     = athleteTestParticipant.AthleteTest,
                    CreatedBy       = athleteTestParticipant.CreatedBy,
                    DistanceCovered = athleteTestParticipant.DistanceCovered,
                    TimeTaken       = athleteTestParticipant.TimeTaken
                };
            }
            else
            {
                _createAthleteTestParticipant = new CreateAthleteTestParticipant();
            }

            return(_createAthleteTestParticipant);
        }
Пример #2
0
        public void CreateAtheleTestParticipant(CreateAthleteTestParticipant input)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            //Apply Business Validation(if any)

            //Mapping
            var athletTestParticipant = new TestParticipant
            {
                AddedDate       = input.AddedDate,
                ModifiedDate    = input.ModifiedDate,
                UserId          = input.UserId,
                CreatedBy       = input.CreatedBy,
                DistanceCovered = input.DistanceCovered,
                TimeTaken       = input.TimeTaken,
                AthleteTest     = input.AthleteTest
            };

            _athleteTestParticipantsRepo.Insert(athletTestParticipant);
        }