public async Task <ActionResult <FilmTrivia> > PostFilmTrivia(FilmTrivia filmTrivia) { _context.FilmTrivias.Add(filmTrivia); await _context.SaveChangesAsync(); return(CreatedAtAction("GetFilmTrivia", new { id = filmTrivia.Id }, filmTrivia)); }
public async Task <IActionResult> PutFilmTrivia(long id, FilmTrivia filmTrivia) { if (id != filmTrivia.Id) { return(BadRequest()); } _context.Entry(filmTrivia).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FilmTriviaExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }