示例#1
0
        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");
            }
        }
示例#2
0
 public ActionResult Edit(Post post)
 {
     if (ModelState.IsValid)
     {
         _postRepository.Update(post);
         return RedirectToAction("Index");
     }
     return View(post);
 }