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); }
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); }
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); }
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); }