public async Task <ActionResult <LibraryTrancs> > Post([FromBody] LibraryTrancs _library) { if (_library == null) { return(NoContent()); } _context.LibraryTrancs.Add(_library); await _context.SaveChangesAsync(); return(CreatedAtAction("GetLibraryTancs", new { Id = _library.Id }, _library)); }
public async Task <IActionResult> Put(int id, [FromBody] LibraryTrancs _library) { if (id != _library.Id) { return(BadRequest()); } _context.Entry(_library).State = EntityState.Modified; try { await _context.SaveChangesAsync(); }catch (DbUpdateConcurrencyException) { if (!LibraryExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }