public ActionResult Edit(PostViewModel vm) { var post = vm.GetPost(); Context.Posts.Save(post); ViewBag.Title = "Edit Post"; ViewBag.Status = string.Format("*** Post {0} was updated! ***", post.Id); return(View(vm)); }
public ActionResult AddPost(PostViewModel vm) { var post = vm.GetPost(); Context.Posts.Insert(post); ModelState.Clear(); ViewBag.Title = "Add New Post"; ViewBag.Status = string.Format("*** New post {0} was created! ***", post.Id); return(View()); }