private bool TryAddComment(IKnowledgeArticleDataAdapter dataAdapter, string authorName, string authorEmail, string content) { if (!Request.IsAuthenticated) { if (string.IsNullOrWhiteSpace(authorName)) { ModelState.AddModelError("authorName", ResourceManager.GetString("Name_Required_Error")); } if (string.IsNullOrWhiteSpace(authorEmail)) { ModelState.AddModelError("authorEmail", ResourceManager.GetString("Email_Required_Error")); } } if (string.IsNullOrWhiteSpace(content) || string.IsNullOrWhiteSpace(StringHelper.GetCommentTitleFromContent(content))) { ModelState.AddModelError("content", ResourceManager.GetString("Comment_Required_Error")); } if (!ModelState.IsValid) { return(false); } dataAdapter.CreateComment(content, authorName, authorEmail); return(true); }
private bool TryAddUpdateRating(IKnowledgeArticleDataAdapter dataAdapter, int rating, int maxRating, int minRating) { if (!ModelState.IsValid) { return(false); } dataAdapter.CreateUpdateRating(rating, maxRating, minRating, HttpContext.Profile.UserName); return(true); }