Ejemplo n.º 1
0
        public async Task <Course> Create(Course course)
        {
            _context.Entry(course).State = Microsoft.EntityFrameworkCore.EntityState.Added;
            await _context.SaveChangesAsync();

            return(course);
        }
        public async Task <Student> Create(Student student)
        {
            // when i have a student, i want to add them to the database.
            _context.Entry(student).State = Microsoft.EntityFrameworkCore.EntityState.Added;
            // the student gets 'saved' here, and then associated with an id.
            await _context.SaveChangesAsync();

            return(student);
        }