public async Task <KeyValuePair <Boolean, List <PizzaModel> > > GetFromTri(ETri tri, string jsonFileName, List <string> favorisList = null) { var results = await this._PizzaRepository.Get(jsonFileName); var sortedList = new List <PizzaModel>(); if (tri == ETri.Nom) { sortedList = results.Value.OrderBy(l => l.ToStringNom) .ToList(); } else if (tri == ETri.Prix) { sortedList = results.Value.OrderBy(l => l.Prix) .ToList(); } else if (tri == ETri.Favoris && favorisList != null) { favorisList.ForEach(l => l = l.ToLower()); sortedList = results.Value.Where(l => favorisList.Contains(l.ToStringNom.ToLower())) .ToList(); } else { sortedList = results.Value; } return(new KeyValuePair <bool, List <PizzaModel> >(results.Key, sortedList)); }
public static string ExtGetImageSource(this ETri eTri) { switch (eTri) { case ETri.Aucun: return("sort_none.png"); case ETri.Nom: return("sort_nom.png"); case ETri.Favoris: return("sort_fav.png"); default: return("sort_prix.png"); } }