Exemplo n.º 1
0
        private bool TryAddIssue(IssueForumDataAdapter issueForumDataAdapter, string title, string authorName, string authorEmail, string copy, bool track)
        {
            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(title))
            {
                ModelState.AddModelError("title", ResourceManager.GetString("Issue_Required_Error"));
            }

            if (!ModelState.IsValid)
            {
                return(false);
            }

            issueForumDataAdapter.CreateIssue(title, copy, track, authorName, authorEmail);

            return(true);
        }
Exemplo n.º 2
0
        private bool TryAddIssue(IssueForumDataAdapter issueForumDataAdapter, string title, string authorName, string authorEmail, string copy, bool track)
        {
            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(title))
            {
                ModelState.AddModelError("title", "Issue is required.");
            }

            if (!ModelState.IsValid)
            {
                return(false);
            }

            issueForumDataAdapter.CreateIssue(title, copy, track, authorName, authorEmail);

            return(true);
        }