public ActionResult Edit(Autor author) { if (_repository.Update(author)) return RedirectToAction("Index"); return View(author); }
public JsonResult UmaAction(int? id, string nome) { var autor = new Autor { Id = 0, Nome = nome }; return Json(autor, JsonRequestBehavior.AllowGet); }
public bool Update(Autor autor) { try { _db.Entry<Autor>(autor).State = EntityState.Modified; _db.SaveChanges(); return true; } catch { return false; } }
public bool Create(Autor autor) { try { _db.Autores.Add(autor); _db.SaveChanges(); return true; } catch { return false; } }
public ViewResult Dados(int Id) { var autor = new Autor { Id = 1, Nome = "André Baltieri" }; ViewBag.Categoria = "Produtos de Limpeza"; ViewData["Categoria"] = "Produtos de Informática"; TempData["Categoria"] = "Produtos de Escritório"; Session["Categoria"] = "Móveis"; return View(autor); }
public JsonResult ActionDois(Autor autor) { return Json(autor); }