private async Task <string> getNomUrl(string nom) { try { List <Etablissement> lEtab = await etablissementService.GetAllEtablissementsAsync(); string NomUrl = Regex.Replace(nom, @"\s", ""); NomUrl = Regex.Replace(nom, @"é|è", "e"); NomUrl = Regex.Replace(nom, @"\$|\§", "s"); NomUrl = Regex.Replace(nom, @"ç", "c"); if (lEtab.Any(x => x.NomUrl.ToUpper() == NomUrl.ToUpper())) { int i = 1; while (lEtab.Any(x => x.NomUrl.ToUpper() == (NomUrl + i).ToUpper())) { i++; } NomUrl += i; } return(NomUrl); } catch (Exception ex) { throw ex; } }
public async Task <List <string> > getCoordinates() { try { List <Etablissement> lEtabl = await etablissementService.GetAllEtablissementsAsync(); List <string> lCoordinates = new List <string>(); foreach (Etablissement etab in lEtabl) { if (etab.estValide) { string adresse = etab.NumeroBoite + "+" + etab.Rue + ",+" + etab.CodePostal + ",+" + etab.Ville + ",+" + etab.Pays; Marker marker = await mapService.GetCoordinates(adresse); marker.Nom = etab.Nom; marker.NomUrl = etab.NomUrl; marker.nbMinAvantFermeture = await estOuvert(etab.Id); string coordinates = JsonConvert.SerializeObject(marker); lCoordinates.Add(coordinates); } } return(lCoordinates); } catch (Exception ex) { throw ex; } }