예제 #1
0
        public async Task <Dbo.Competition> Create(Dto.Competition competition)
        {
            Validated.NotNull(competition, nameof(competition));

            Dbo.Competition addedCompetition = this.unitOfWork.Competitions.Add(mapper.Map(competition));

            await this.unitOfWork.SaveChanges();

            return(addedCompetition);
        }
예제 #2
0
        public Dbo.Competition Map(Dto.Competition competition)
        {
            if (competition == null)
            {
                return(null);
            }

            var result = new Dbo.Competition
            {
                CompetitionId = competition.Id,
                Name          = competition.Name
            };

            return(result);
        }
예제 #3
0
        private Dto.Competition ShortMap(Dbo.Competition competition)
        {
            if (competition == null)
            {
                return(null);
            }

            var result = new Dto.Competition
            {
                Id   = competition.CompetitionId,
                Name = competition.Name,
            };

            return(result);
        }
예제 #4
0
        public Dto.Competition Map(Dbo.Competition competition)
        {
            if (competition == null)
            {
                return(null);
            }

            var result = new Dto.Competition
            {
                Id    = competition.CompetitionId,
                Name  = competition.Name,
                Teams = competition.Teams.Select(t => new Dto.Team {
                    Id = t.TeamId, Name = t.Team.Name
                }).ToArray()
            };

            return(result);
        }