Exemple #1
0
        public static Models.TextBlock GetPlain(string sectionCode, string defaultTextHtml = null, string defaultTitle = null)
        {
            CheckForDrop(sectionCode);
            var tb = All.Filter(textBlock => textBlock.SectionCode == sectionCode).FirstOrDefault();

            if (tb == null)
            {
                // add it to the database
                tb             = new Models.TextBlock();
                tb.SectionCode = sectionCode;
                if (defaultTitle != null)
                {
                    tb.IsTitleAvailable = true;
                    tb.Title            = defaultTitle;
                }
                else
                {
                    tb.IsTitleAvailable = false;
                }
                tb.IsBodyPlainText    = true;
                tb.IsUrlAvailable     = false;
                tb.IsPictureAvailable = false;
                tb.BodyTextHtml       = defaultTextHtml ?? Fmt.SplitTitleCase(sectionCode) + " content goes here";
                tb.Save();
                All.Add(tb);
            }
            return(tb);
        }
Exemple #2
0
        public ActionResult SendComment(int?auctionID, int?buyNowID, string name, string email, string comment, string auth, int?parentID, string optin)
        {
            if (!ValidateAuthToken(auth))
            {
                return(Content("Sorry, your session has timed out. Please refresh the page and try again."));
            }
            var c = new Comment();

            //c.UpdateFromRequest(); //MK why UpdateFromRequest? all values are passed in as parameters right?

            c.CommentText = comment;
            c.CommentDate = DateTime.Now;
            c.Status      = Comment.CommentStatus.Submitted.ToString();
            //	c.AuctionID = auctionID;
            //	c.BuyNowItemID = buyNowID;
            c.CommenterIP     = Security.UserIpV4Address();
            c.ParentCommentID = parentID;
            c.PersonType      = Comment.CommentPersonType.Member.ToString();
            if (Security.IsLoggedIn)
            {
                var p = Person.LoadByPersonID(Security.LoggedInUserID);

                /*if (p.Role == SecurityRoles.Roles.MODERATOR) {
                 *      // a moderator
                 *      c.PersonType = Comment.CommentPersonType.Moderator.ToString();
                 * }
                 */
                //c.CommenterName = p.UserName;
                c.CommenterEmail = p.Email;
                c.PersonID       = p.ID;
            }
            else
            {
                c.CommenterName  = name.Trim();
                c.CommenterEmail = email;
            }
            c.Save();

            if (optin == "true")
            {
                //Beweb.SiteCustom.MailChimp.Subscribe(c.CommenterEmail, Person.GetFirstName(c.CommenterName), Person.GetLastName(c.CommenterName), "", "");
            }
            Models.TextBlock thanksTextBlock = TextBlockCache.GetRich("CommentThankYou");
            return(View("CommentThankYou", thanksTextBlock));
        }