Ejemplo n.º 1
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(textBoxteacher.Text))
     {
         var Teacher = new Teacher()
         {
             Name = textBoxteacher.Text
         };
         db.ClassTeacher.Add(Teacher);
         db.SaveChanges();
         ReloadTeachersGrid();
         textBoxteacher.Text = "";
         ReloadClassesTeacherCombo();
     }
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            int recsAdded = 0;

            using (CodeFirst db = new CodeFirst())
            {
                Recipe recipe = new Recipe
                {
                    Comment     = "Fun Comment",
                    Directions  = "New Directions",
                    RecipeType  = "Object Recipe Type",
                    ServingSize = "Serves Sizes XS-XL",
                    Title       = "Delicious Recipe",
                    Yield       = "Yield. No you yield!"
                };

                Ingredient ingredient = new Ingredient()
                {
                    Description = "This is my cool description",
                    RecipeID    = 1
                };

                db.Recipes.Add(recipe);
                db.Ingredients.Add(ingredient);
                recsAdded = db.SaveChanges();

                Recipe rec = (from r in db.Recipes
                              select r).FirstOrDefault();

                System.Console.WriteLine(rec.Comment.ToString());

                System.Console.ReadLine();
            }
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            var context = new CodeFirst();

            context.Employees.Add(new Employee {
                FirstName = "petko"
            });
            context.SaveChanges();
        }