public async Task <ActionResult <FilmsItem> > PostFilmsItem(FilmsItem filmsItem) { _context.filmsItems.Add(filmsItem); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetFilmsItem), new { id = filmsItem.Id }, filmsItem)); }
public async Task <IActionResult> PutFilmsItem(int id, FilmsItem filmsItem) { if (id != filmsItem.Id) { return(BadRequest()); } _context.Entry(filmsItem).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FilmsItemExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }