Пример #1
0
 public ActionResult Adiciona(Post post)
 {
     if (ModelState.IsValid)
     {
         _dao.Incluir(post);
         return(RedirectToAction("Index"));
     }
     //Bad Request
     HttpContext.Response.StatusCode = 400;
     return(View("Novo", post));
 }
Пример #2
0
 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));
 }
Пример #3
0
 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));
 }