private bool TryAddComment(IssueDataAdapter issueDataAdapter, 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)) { ModelState.AddModelError("content", ResourceManager.GetString("Comment_Required_Error")); } if (!ModelState.IsValid) { return(false); } issueDataAdapter.CreateComment(content, authorName, authorEmail); return(true); }
private bool TryAddComment(IssueDataAdapter issueDataAdapter, string authorName, string authorEmail, string content) { if (!Request.IsAuthenticated) { if (string.IsNullOrWhiteSpace(authorName)) { ModelState.AddModelError("authorName", "Your name is required."); } if (string.IsNullOrWhiteSpace(authorEmail)) { ModelState.AddModelError("authorEmail", "Email is required; it will not be displayed."); } } if (string.IsNullOrWhiteSpace(content)) { ModelState.AddModelError("content", "Comment is required."); } if (!ModelState.IsValid) { return(false); } issueDataAdapter.CreateComment(content, authorName, authorEmail); return(true); }