public TeamDetailModel GetById(Guid id) { using (var teamCommunicationDbContext = dbContextFactory.CreateDbContext()) { var team = teamCommunicationDbContext.Teams.Find(id); return(team != null?TeamMapper.MapTeamEntityToDetailModel(team) : null); } }
public TeamDetailModel Add(TeamDetailModel detail) { using (var teamCommunicationDbContext = dbContextFactory.CreateDbContext()) { var team = TeamMapper.MapTeamDetailModelToEntity(detail); team.Id = Guid.NewGuid(); teamCommunicationDbContext.Teams.Add(team); teamCommunicationDbContext.SaveChanges(); return(TeamMapper.MapTeamEntityToDetailModel(team)); } }