Example #1
0
        public static void Main(string[] args)
        {
            var db = new PlutoContext();

            // Get all courses taught by
            db.Courses
            .Where(c => c.Author.Name == "Karen Hawkins")
            .Select(c => c.Title)
            .ToList()
            .ForEach(Console.WriteLine);

            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            var ctx = new PlutoContext();

            ctx.Courses.Add(new Course
            {
                Author = new Author
                {
                    Id   = 1,
                    Name = "Tolstoy"
                },
                Description = "Big book",
                FullPrice   = 10,
                Id          = 1,
                Level       = CourseLevel.Advanced,
                Name        = "Peace and war"
            });
            ctx.SaveChanges();
        }