public ActionResult Update(UpdatePost updatePost) { var post = _posts.Get(updatePost.Id); if (ModelState.IsValid) { var result = _commandCoordinator.Handle<Domain.Posts.Post>(updatePost.Id, p => p.SetBody(updatePost.Body)); //var result = _commandCoordinator.Handle(updatePost); if (result.Exception != null) return RedirectToAction("List"); return View("Show", GetPostViewModelFromPost(post)); } return RedirectToAction("Show", GetPostViewModelFromPost(post)); }
public void Handle(UpdatePost updatePost) { var post = _repository.Get(updatePost.Id); post.SetTitle(updatePost.Title); post.SetBody(updatePost.Body); }