Ejemplo n.º 1
0
        public async Task <ActionResult <Course> > PostCourse(Course course)
        {
            await _course.Create(course);

            // Returns a 201 Header
            // The body will be the result of calling GetCourse with the id
            return(CreatedAtAction("GetCourse", new { id = course.Id }, course));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <Course> > PostCourse(Course course)
        {
            await _course.Create(course);

            return(CreatedAtAction("GetCourse", new { id = course.Id }, course));
        }
 public async Task CreateCourse(int id, string name, IEnumerable <Student> students, ApplicationUser instructor)
 {
     var newCourse = new Course();
     var course    = _courseService.Create(newCourse);
     await _context.SaveChangesAsync();
 }