public async Task <PingUser> FindByNameAsync(string nom, string prenom, CancellationToken cancellationToken = default(CancellationToken)) { var result = await this.PingDbContext.Users.Where(pinguser => pinguser.Nom == nom && pinguser.Prenom == prenom).FirstOrDefaultAsync(); if (result == null) { var uri = SpidApiNomPrenomPath(nom, prenom); result = await SpidRequest.LoadFromSpid <ListeJoueurHeader, JoueurDto, PingUser>(uri, true, liste => liste.Liste.Joueur, (db, user) => { db.Add <PingUser>(user); }); } return(result); }
public async Task <PingUser> FindByLicenceAsync(string licence, CancellationToken cancellationToken = default(CancellationToken)) { var result = await this.PingDbContext.Users.Where(pinguser => pinguser.Id == licence).FirstOrDefaultAsync(); if (result == null) { var uri = SpidApiLicencePath(licence); result = await SpidRequest.LoadFromSpid <ListeJoueurHeader, JoueurDto, PingUser>(uri, true, liste => liste.Liste.Licence, (db, user) => { db.Add <PingUser>(user); }); } return(result); }