static void RemoveData() { var context = new PlutoContext(); var course = context.Courses.Find(6); context.Courses.Remove(course); context.SaveChanges(); }
static void UpdateData() { var context = new PlutoContext(); var course = context.Courses.Find(1); course.Name = "New course name"; course.AuthorId = 2; context.SaveChanges(); }
static void AddingData() { var context = new PlutoContext(); var author = context.Authors.Single(a => a.Id == 1); var course = new Course { Name = "New Course", Description = "New Description", FullPrice = 19.95f, Level = 1, Author = author }; context.Courses.Add(course); context.SaveChanges(); }