示例#1
0
        public async Task <ActionResult <LibroItem> > Post(LibroItem item)
        {
            _context.LibroItems.Add(item);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetLibro), new { id = item.Id }, item));
        }
示例#2
0
        public async Task <IActionResult> Put(int id, LibroItem item)
        {
            if (id != item.Id)
            {
                return(BadRequest());
            }
            _context.Entry(item).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(NoContent());
        }