Exemplo n.º 1
0
        public void DeleteStudent(string id)
        {
            s14456Context dbContext = new s14456Context();

            Models.Student student = dbContext.Student.SingleOrDefault(s => s.IndexNumber == id);
            dbContext.Student.Remove(student);
            dbContext.SaveChanges();
        }
Exemplo n.º 2
0
        public void ModifyStudent(Student student)
        {
            s14456Context dbContext = new s14456Context();
            var           res       = new Models.Student
            {
                IndexNumber = student.IndexNumber,
                FirstName   = student.FirstName,
                LastName    = student.LastName,
                BirthDate   = student.BirthDate
            };

            dbContext.Attach(res);
            dbContext.Entry(res).Property("FirstName").IsModified = true;
            dbContext.Entry(res).Property("LAstName").IsModified  = true;
            dbContext.Entry(res).Property("BirthDate").IsModified = true;
            dbContext.SaveChanges();
        }