Exemple #1
0
        public static void Delete_Data(FacultyContext context)
        {
            Student student = context.Students.LastOrDefault();

            context.Students.Remove(student);

            context.SaveChanges();
        }
Exemple #2
0
        public static void Add_Data(FacultyContext context)
        {
            Student student = new Student {
                Lastname = "Hayrapetyan", FirstName = "Martin", Age = 25
            };

            context.Students.Add(student);
            context.SaveChanges();
        }
Exemple #3
0
        public static void Update_Data(FacultyContext context)
        {
            Student student = context.Students.AsNoTracking().FirstOrDefault();

            student.FirstName = "Armen";
            student.Lastname  = "Hovhannisyan";

            context.Students.Update(student);

            context.SaveChanges();
        }