public async Task <IActionResult> PutFilmText(short id, FilmText filmText) { if (id != filmText.FilmId) { return(BadRequest()); } _context.Entry(filmText).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FilmTextExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <FilmText> > PostFilmText(FilmText filmText) { _context.FilmText.Add(filmText); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (FilmTextExists(filmText.FilmId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetFilmText", new { id = filmText.FilmId }, filmText)); }