public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,Ativo")] Autor autor) { if (id != autor.Id) { return(NotFound()); } if (ModelState.IsValid) { try { await _context.Update(autor); } catch (DbUpdateConcurrencyException) { if (!await AutorExists(autor.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(autor)); }
public async Task <IActionResult> PutAutor(int id, Autor autor) { if (id != autor.Id) { return(BadRequest()); } try { await _context.Update(autor); } catch (DbUpdateConcurrencyException) { if (!await AutorExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Edit(int id, AutorViewModel autorViewModel) { try { if (ModelState.IsValid) { _autorApp.Update(autorViewModel); return(RedirectToAction(nameof(Index))); } } catch { return(View(autorViewModel)); } return(View(autorViewModel)); }
public void Put(int id, [FromBody] AutorViewModel autorViewModel) { _autorApp.Update(autorViewModel); }