public virtual ActionResult Update(string nickname, EditPostViewModel model) { if (!ModelState.IsValid) { return View("Edit", model); } return UpdatePost(nickname, model); }
public void GivenAPostWithMalformedHTML_WhenItIsRetrievedForTheView_ThenTheHtmlIsWellFormed() { var model = new EditPostViewModel(); model.Post = "<span>Test"; Assert.That(model.Post, Is.StringEnding("</span>")); }
private ActionResult UpdatePost(string nickname, EditPostViewModel model) { var blog = _blogService.GetBlog(nickname); _dashboardService.Update(model.PostId, model.Title, model.Post, blog.Id); return RedirectToRoute(new { controller = "Dashboard", action = "Index" }); }
private ActionResult CreatePost(string nickname, EditPostViewModel model) { var blog = _blogService.GetBlog(nickname); var post = new Post { Title = model.Title, BlogPost = model.Post, Edited = DateTime.UtcNow, Posted = DateTime.UtcNow, BlogId = blog.Id, CommentsEnabled = true, //todo: get this from the admin }; _dashboardService.CreatePost(post, blog.Id); return RedirectToRoute(new { controller = "Dashboard", action = "Index" }); }