示例#1
0
        public void Inserir()
        {
            using (var ctx = new ReceitaContexto())
            {
                Entidades.Ingrediente ingrediente = new Entidades.Ingrediente("Bolo de cenoura", Unidade.Mililitros);

                ctx.Ingrediente.Add(ingrediente);
                ctx.SaveChanges();
            }
        }
示例#2
0
        public void Inserir_Receita_Ingredientes()
        {
            using (var ctx = new ReceitaContexto())
            {
                Entidades.Ingrediente ingrediente = ctx.Ingrediente.Find(new Guid("78C77BFA-2480-40B8-880C-04AFA83D68B9"));
                Entidades.Receita     receita     = new Entidades.Receita("Bolo de laranja", "Acrescentar ingredientes");
                receita.Ingredientes.Add(new IngredienteReceita(ingrediente, receita, 100));

                ctx.Receita.Add(receita);
                ctx.SaveChanges();
            }
        }