public ActionResult Form(long newsId) { var model = new CommentAddOrUpdateViewModel { ArticleId = newsId, }; return PartialView("Form", model); }
public ActionResult Form(CommentAddOrUpdateViewModel model) { if (!ValidateRecaptcha()) { ModelState.AddModelError("reCaptcha", "reCaptcha didn't go as expected."); } if (ModelState.IsValid) { var added = _commentsService.AddOrUpdate(model); if (added) { return ForNews(model.ArticleId); } } return PartialView(model); }
public static Comment MapToModel(this CommentAddOrUpdateViewModel vm) { return(Mapper.Map <Comment>(vm)); }