public ActionResult Default(FormCollection model) {
			_page = PagePayload.GetCurrentContent();

			Object frm = null;

			if (Request.Form["form_type"] != null) {
				string formMode = Request.Form["form_type"].ToString().ToLower();

				if (formMode == "searchform") {
					frm = new SiteSearch();
					frm = FormHelper.ParseRequest(frm, Request);
					this.ViewData["CMS_searchform"] = frm;
					if (frm != null) {
						this.TryValidateModel(frm);
					}
				}

				if (formMode == "contactform") {
					frm = new ContactInfo();
					frm = FormHelper.ParseRequest(frm, Request);
					var cmt = (ContactInfo)frm;
					cmt.Root_ContentID = _page.ThePage.Root_ContentID;
					cmt.CreateDate = SiteData.CurrentSite.Now;
					cmt.CommenterIP = Request.ServerVariables["REMOTE_ADDR"];
					this.ViewData["CMS_contactform"] = frm;
					if (cmt != null) {
						this.TryValidateModel(cmt);
					}
				}
			}

			return DefaultView();
		}
Esempio n. 2
0
        public HtmlHelper <SiteSearch> GetModelHelper()
        {
            SiteSearch model = new SiteSearch();

            if (_helper.ViewData["CMS_searchform"] != null)
            {
                model = _helper.ViewData["CMS_searchform"] as SiteSearch;
            }
            else
            {
                model = new SiteSearch();
            }

            return(new HtmlHelper <SiteSearch>(_helper.ViewContext, new WrapperForHtmlHelper <SiteSearch>(model)));
        }