public async Task <IEnumerable <FrutasAzure> > ObterFrutas() { var empty = new FrutasAzure[0]; try { return(await _table.ToEnumerableAsync()); } catch (System.Exception ex) { return(empty); } }
public static async void GerarListaFrutas(ObservableCollection <FrutasAzure> lista) { lista.Clear(); Random random = new Random(); Array estacoes = Enum.GetValues(typeof(Estacao)); for (int i = 0; i < 20; i++) { var fruta = new FrutasAzure(); fruta.NomeFruta = (string)baseFrutas.GetValue(random.Next(baseFrutas.Length)); fruta.Estacao = (string)estacoes.GetValue(random.Next(estacoes.Length)); fruta.Cidade = (string)baseCidades.GetValue(random.Next(baseCidades.Length)); lista.Add(fruta); } }
public static void GerarListaFrutas(int qtdade) { Random random = new Random(); Array estacoes = Enum.GetValues(typeof(Estacao)); for (int i = 0; i < qtdade; i++) { var fruta = new FrutasAzure(); fruta.NomeFruta = (string)baseFrutas.GetValue(random.Next(baseFrutas.Length)); fruta.Estacao = (string)estacoes.GetValue(random.Next(estacoes.Length)); fruta.Cidade = (string)baseCidades.GetValue(random.Next(baseCidades.Length)); var service = new AzureService(); service.AdicionarFrutas(fruta); } }
public async void AdicionarFrutas(FrutasAzure frutas) { await _table.InsertAsync(frutas); }