Esempio n. 1
0
        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());
        }
Esempio n. 2
0
        public ActionResult Put(int id, [FromBody] Book book)
        {
            if (id != book.Id)
            {
                return(BadRequest());
            }

            _context.Entry(book).State = EntityState.Modified;
            _context.SaveChanges();
            return(Ok());
        }