public async Task DeleteRequest(Guid userId, Guid competitionId) { var existingAdminRequest = await _adminRequestRepo.Get(userId, competitionId); existingAdminRequest.EnsureExists("Admin request not found."); _adminRequestRepo.Delete(existingAdminRequest); await _adminRequestRepo.Save(); }
public async Task <CompetitionResponse> AddAdminToCompetition(Guid userId, Guid competitionId) { var existingAdmin = await _adminRepo.Get(userId, competitionId); existingAdmin.EnsureDoesNotExist(); var existingAdminRequest = await _adminRequestRepo.Get(userId, competitionId); existingAdminRequest.EnsureExists("Admin request not found."); _adminRepo.Create(new Admin(userId, competitionId)); _adminRequestRepo.Delete(existingAdminRequest); await _adminRepo.Save(); //return competition with admin information var competition = await _competitionRepo.GetWithInfo(competitionId); return(new CompetitionResponse(competition, true, userId)); }