public async Task <ActionResult <NameListItem> > PostNameListItem(NameListItem item) { _context.NameListItems.Add(item); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetNameListItem), new { id = item.Id }, item)); }
public async Task <IActionResult> PutNameListItem(long id, NameListItem item) { if (id != item.Id) { return(BadRequest()); } _context.Entry(item).State = EntityState.Modified; await _context.SaveChangesAsync(); return(NoContent()); }