public SummonerVerificationModel Add(int userId, SummonerModel summonerModel) { Summoner existingSummoner = _summonerRepository.Get(summonerModel.Name, summonerModel.Region.Id); if (existingSummoner.IsVerified) { throw new BadRequestException("This League of Legends account has already been verified by somebody else."); } LeagueSummoner leagueSummoner = _apiService.GetSummoner(summonerModel.Region.Id, summonerModel.Name); string verificationCode = _secureTokenGenerator.GenerateToken(_verificationTokenLength); Summoner summoner = new Summoner() { LeagueApiId = leagueSummoner.Id, Name = leagueSummoner.Name, UserId = userId, Region = _regionRepository.GetFromLeagueId(summonerModel.Region.Id), VerificationCode = verificationCode, IsVerified = false }; _summonerRepository.Add(summoner); return new SummonerVerificationModel() { Code = verificationCode, Summoner = _summonerModelMapper.ToModel(summoner) }; }
public bool ConfirmSummoner(Summoner summoner) { RunepagesDTO runepagesDto = _leagueRequestService.GetRunepages(summoner.Region.LeagueApiId, summoner.LeagueApiId); return runepagesDto.Pages.Any(rp => rp.Name == summoner.VerificationCode); }
public void Update(Summoner summoner) { }
public void Delete(Summoner summoner) { }
public void Add(Summoner summoner) { summoner.Id = 1; }