public async Task <IActionResult> Create([Bind("Id,Nome,Ativo")] Autor autor)
        {
            if (ModelState.IsValid)
            {
                await _context.Add(autor);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(autor));
        }
Beispiel #2
0
        public async Task <ActionResult <Autor> > PostAutor(Autor autor)
        {
            await _context.Add(autor);

            return(CreatedAtAction("GetAutor", new { id = autor.Id }, autor));
        }