public async Task <ActionResult> Put(int id, [FromBody] AuthorCreateDTO authorUpdateDTO) { var author = _mapper.Map <Author>(authorUpdateDTO); author.Id = id; _context.Entry(author).State = EntityState.Modified; /*_context.Authors.Update(author);*/ // Actualizaciones parciales. await _context.SaveChangesAsync(); return(NoContent()); }
public ActionResult Put(int id, [FromBody] Book book) { if (id != book.Id) { return(BadRequest()); } _context.Entry(book).State = EntityState.Modified; _context.SaveChanges(); return(Ok()); }