private static void Excluir() { try { using (var repIngredientes = new IngredienteRepository()) { repIngredientes.Excluir(i => i.Descricao.Length > 0); repIngredientes.SalvarTodos(); System.Console.WriteLine("======= Ingredientes Excluídos ========"); } using (var repReceitas = new ReceitaRepository()) { repReceitas.Excluir(i => i.Descricao.Length > 0); repReceitas.SalvarTodos(); System.Console.WriteLine("======= Receitas Excluídas ========"); } using (var repReceitasItens = new ReceitaItensRepository()) { repReceitasItens.Excluir(i => i.ReceitaId > 0); repReceitasItens.SalvarTodos(); System.Console.WriteLine("======= Itens de Receitas Excluídas ========"); } } catch (Exception) { System.Console.WriteLine("Erro ao excluir!"); } }
private static void AdicionarIngredientes() { using (var repIngredientes = new IngredienteRepository()) { new List <Ingrediente> { new Ingrediente { IngredienteId = 1, Descricao = "Leite Moça", DataCadastro = DateTime.Now, Preco = 50.99, Unidade = "Unidade" }, new Ingrediente { IngredienteId = 2, Descricao = "Farinha de Trigo 500g", DataCadastro = DateTime.Now, Preco = 2.99, Unidade = "Unidade" }, new Ingrediente { IngredienteId = 3, Descricao = "Granulado", DataCadastro = DateTime.Now, Preco = 1.50, Unidade = "Unidade" } }.ForEach(repIngredientes.Adicionar); repIngredientes.SalvarTodos(); System.Console.WriteLine("========== Ingredientes Cadastrados ============"); foreach (var i in repIngredientes.GetAll()) { System.Console.WriteLine("{0} - {1}", i.IngredienteId, i.Descricao); } } }
private async void FormIngredientes_Load(object sender, EventArgs e) { lblNombre.Text = _nombre; _ingredienteRepository = new IngredienteRepository(); _unidadRepository = new UnidadRepository(); await CargarIngredientes(); await CargarUnidades(); }
public FormMain() { InitializeComponent(); _productoRepository = new ProductoRepository(); _IngredienteRepository = new IngredienteRepository(); _InstruccionRepository = new InstruccionRepository(); _ImagenRepository = new ImagenRepository(); imagenpath = ConfigurationManager.AppSettings["LogoPath"].ToString(); }
private async void consultas_Load(object sender, EventArgs e) { _productoRepository = new ProductoRepository(); _imagenRepository = new ImagenRepository(); _ingredienteRepository = new IngredienteRepository(); _instruccionRepository = new InstruccionRepository(); await CargarProductos(); }
public altas() { InitializeComponent(); _producto = new Producto(); _Ingredientes = new List <Ingrediente>(); _Instrucciones = new List <Instruccion>(); _productoRepository = new ProductoRepository(); _instruccionRepository = new InstruccionRepository(); _imagenRepository = new ImagenRepository(); _ingredienteRepository = new IngredienteRepository(); _Imagenes = new List <Imagen>(); coll = new AutoCompleteStringCollection(); }
private static void AdicionarReceitaItens(Receita receita) { using (var repItens = new ReceitaItensRepository()) { using (var repIngr = new IngredienteRepository()) { foreach (var ingr in repIngr.GetAll()) { repItens.Adicionar(new ReceitaItens() { ReceitaId = receita.ReceitaId, IngredienteId = ingr.IngredienteId }); } } repItens.SalvarTodos(); }; }
private List <Ingrediente> GetIngredientes(Lanche lanche) { var listIngredientes = new List <Ingrediente>(); var alfaceQt = Convert.ToInt32(driver.FindElement(By.Id(String.Concat("txtIngrediente", (int)IngredienteEnum.Alface))).GetAttribute("value")); var baconQt = Convert.ToInt32(driver.FindElement(By.Id(String.Concat("txtIngrediente", (int)IngredienteEnum.Bacon))).GetAttribute("value")); var hamburguerCarneQt = Convert.ToInt32(driver.FindElement(By.Id(String.Concat("txtIngrediente", (int)IngredienteEnum.HamburguerCarne))).GetAttribute("value")); var ovoQt = Convert.ToInt32(driver.FindElement(By.Id(String.Concat("txtIngrediente", (int)IngredienteEnum.Ovo))).GetAttribute("value")); var queijoQt = Convert.ToInt32(driver.FindElement(By.Id(String.Concat("txtIngrediente", (int)IngredienteEnum.Queijo))).GetAttribute("value")); var ingredientes = new IngredienteRepository(new TesteDextraContext()).GetComplementosLanche(); var ingredienteAlface = ingredientes.First(x => x.IdIngrediente == (int)IngredienteEnum.Alface); var ingredienteBacon = ingredientes.First(x => x.IdIngrediente == (int)IngredienteEnum.Bacon); var ingredienteHamburguerCarne = ingredientes.First(x => x.IdIngrediente == (int)IngredienteEnum.HamburguerCarne); var ingredienteOvo = ingredientes.First(x => x.IdIngrediente == (int)IngredienteEnum.Ovo); var ingredientesQueijo = ingredientes.First(x => x.IdIngrediente == (int)IngredienteEnum.Queijo); for (var i = 0; i < alfaceQt; i++) { listIngredientes.Add(ingredienteAlface); } for (var i = 0; i < baconQt; i++) { listIngredientes.Add(ingredienteBacon); } for (var i = 0; i < hamburguerCarneQt; i++) { listIngredientes.Add(ingredienteHamburguerCarne); } for (var i = 0; i < ovoQt; i++) { listIngredientes.Add(ingredienteOvo); } for (var i = 0; i < queijoQt; i++) { listIngredientes.Add(ingredientesQueijo); } listIngredientes.AddRange(lanche.LancheIngredientes.Select(x => x.Ingrediente)); return(listIngredientes); }
public async Task <List <Ingrediente> > GetAllIngredienteAsync() { var result = await IngredienteRepository.GetAllIngredienteAsync(); return(result); }
public IngredienteLogic() { this.IngredienteRepository = new IngredienteRepository(); }
public IngredienteRepository GetIngredienteRepository() { return(_ingredienteRepository ?? (_ingredienteRepository = new IngredienteRepository(_databaseContext))); }
public IngredientesController() { _ingredienteRepository = new IngredienteRepository(); }