public async Task <List <ComuneItalianoJson> > GetJsonDataAsync() { if (ListaComuniJson == null || ListaComuniJson?.Count() <= 0) { string json = File.ReadAllText(_appResources.ComuniItalianiJson); ListaComuniJson = JsonConvert.DeserializeObject <List <ComuneItalianoJson> >(json); } return(await Task.FromResult(this.ListaComuniJson)); }
public async Task <List <ComuneItalianoJson> > GetFromJsonByAsync( string CAP = null, string codiceCatastale = null) { var spec = Spec.Any <ComuneItalianoJson>(); if (!string.IsNullOrWhiteSpace(CAP)) { CAP = CAP.Replace(" ", ""); spec &= new Spec <ComuneItalianoJson>(t => t.CAP.Any(i => i.ToUpper() == CAP.ToUpper())); } if (!string.IsNullOrWhiteSpace(codiceCatastale)) { codiceCatastale = codiceCatastale.Replace(" ", ""); spec &= new Spec <ComuneItalianoJson>(t => t.CodiceCatastale.ToUpper() == codiceCatastale.ToUpper()); } return(await Task.FromResult(ListaComuniJson.AsQueryable().Where(spec.Expression).ToList())); }