public async Task <ActionResult <DetailCourse> > PostDetailCourse(DetailCourse detailCourse) { _context.DetailCourse.Add(detailCourse); await _context.SaveChangesAsync(); return(CreatedAtAction("GetDetailCourse", new { id = detailCourse.Id }, detailCourse)); }
public async Task <IActionResult> PutDetailCourse(int id, DetailCourse detailCourse) { if (id != detailCourse.Id) { return(BadRequest()); } _context.Entry(detailCourse).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DetailCourseExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }