public async Task <GoalResponse> AddGoal(Guid userId, GoalRequest request) { var challenge = _mappingService.CreateChallenge(request); var goal = _mappingService.CreateGoal(userId, challenge.ChallengeId, request); _challengeRepo.Create(challenge); _goalRepo.Create(goal); await _goalRepo.Save(); return(new GoalResponse(goal)); }
public async Task <CompetitionResponse> AddCompetition(Guid userId, CompetitionRequest request) { var challenge = _mappingService.CreateChallenge(request); var competition = _mappingService.CreateCompetition(challenge.ChallengeId, request); _challengeRepo.Create(challenge); _competitionRepo.Create(competition); _participantRepo.Create(new Participant(userId, competition.CompetitionId)); _adminRepo.Create(new Admin(userId, competition.CompetitionId)); await _competitionRepo.Save(); return(new CompetitionResponse(competition, true, userId)); }