예제 #1
0
        public System.Web.Mvc.ActionResult Submit(Models.Site site, System.Web.Mvc.ControllerContext controllerContext, Models.SubmissionSetting submissionSetting)
        {
            Exception exception = null;
            try
            {
                var defaultValues = new NameValueCollection(controllerContext.HttpContext.Request.Unvalidated().Form);
                var valueProvider = new MvcValueProvider(controllerContext.Controller.ValueProvider);

                var formValues = PluginHelper.ApplySubmissionSettings(submissionSetting, defaultValues, valueProvider);

                var from = formValues["From"];
                var subject = formValues["Subject"];
                var body = formValues["Body"];
                var isBodyHtml = !string.IsNullOrEmpty(formValues["isBodyHtml"]) && formValues["isBodyHtml"].ToLower() == "true";
                SendMail(site, from, subject, body, isBodyHtml, controllerContext.HttpContext.Request.Files);
            }
            catch (Exception e)
            {
                exception = e;
            }
            return PluginHelper.ReturnActionResult(controllerContext, null, exception);
        }
예제 #2
0
파일: ContentPlugin.cs 프로젝트: Godoy/CMS
        public ActionResult Submit(Site site, ControllerContext controllerContext, SubmissionSetting submissionSetting)
        {
            object model = null;
            Exception exception = null;
            var formValues = new NameValueCollection(controllerContext.HttpContext.Request.Unvalidated().Form);
            try
            {
                var repository = site.GetRepository();
                var valueProvider = new MvcValueProvider(controllerContext.Controller.ValueProvider);
                formValues = PluginHelper.ApplySubmissionSettings(submissionSetting, formValues, valueProvider);
                var folderName = formValues["FolderName"];
                if (!string.IsNullOrEmpty(folderName))
                {
                    var folder = FolderHelper.Parse<TextFolder>(repository, folderName);
                    model = DoPost(repository, folder, controllerContext, formValues);
                }
            }
            catch (Exception e)
            {
                exception = e;
            }

            return PluginHelper.ReturnActionResult(controllerContext, model, exception);
        }