public ActionResult EditPost(Post post) { if(ModelState.IsValid) { _unitOfWork.Post.Update(post); _unitOfWork.Save(); return RedirectToAction("ViewAllPost",new{id= post.BlogId}); } return View(); }
public ActionResult CreatePost(Int64 id, Post post) { if (ModelState.IsValid) { post.BlogId = id; post.DateCreate = DateTime.Today; _unitOfWork.Post.Add(post); _unitOfWork.Save(); return RedirectToAction("ViewAllPost", new { id }); } return View(); }