public ActionResult Create(Post post) { if (!ModelState.IsValid) { return View(post); } post.Fecha = DateTime.UtcNow; _postRepository.Create(post); if (Request.IsAjaxRequest()) { return Json(new { Result = true, Url = Url.Action("Index") }); } else { return RedirectToAction("Index"); } }
public ActionResult Edit(Post post) { if (ModelState.IsValid) { _postRepository.Update(post); return RedirectToAction("Index"); } return View(post); }