public ActionResult Adiciona(Post post) { if (ModelState.IsValid) { _dao.Incluir(post); return(RedirectToAction("Index")); } //Bad Request HttpContext.Response.StatusCode = 400; return(View("Novo", post)); }
public ActionResult Adiciona(Post post) { if (ModelState.IsValid) { post.AutorId = User.Identity.GetUserId(); _dao.Incluir(post); return(RedirectToAction("Index")); } //Bad Request HttpContext.Response.StatusCode = 400; return(View("Form", post)); }
public ActionResult Adiciona(Post post) { if (ModelState.IsValid) { if (User.Identity.IsAuthenticated) { post.AutorId = this.User.Identity.GetUserId(); } _dao.Incluir(post); return(RedirectToAction("Index", new { Area = "Admin" })); } //Bad Request HttpContext.Response.StatusCode = 400; return(View("Form", post)); }