Example #1
0
        public IActionResult RemoveStudent(string indexNumber)
        {
            var db = new s17179Context();

            var student = db.Student
                          .Where(s => s.IndexNumber == indexNumber)
                          .Single();

            db.Remove(student);
            db.SaveChanges();

            return(Ok());
        }
Example #2
0
        public IActionResult UpdateStudent(string indexNumber, StudentDto studentDto)
        {
            var db = new s17179Context();

            var student = db.Student
                          .Where(s => s.IndexNumber == indexNumber)
                          .Single();

            student.FirstName = studentDto.FirstName;
            student.LastName  = studentDto.LastName;
            db.SaveChanges();

            return(Ok(student));
        }