Пример #1
0
        /// <summary>
        /// Save form configurations
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ResponseModel SaveConfiguration(ConfigurationSetupModel model)
        {
            var form = GetById(model.Id);

            if (form != null)
            {
                form.Name            = model.Name;
                form.FromName        = model.FromName;
                form.FromEmail       = model.FromEmail;
                form.ThankyouMessage = model.ThankyouMessage;
                form.AllowAjaxSubmit = model.AllowAjaxSubmit;
                form.StyleId         = model.StyleId;

                form.SendSubmitFormEmail = model.SendSubmitFormEmail;
                form.EmailTo             = model.EmailTo;

                form.SendNotificationEmail = model.SendNotificationEmail;
                form.NotificationSubject   = model.NotificationSubject;
                form.NotificationBody      = model.NotificationBody;
                form.NotificationEmailTo   = model.NotificationEmailTo;

                form.SendAutoResponse    = model.SendAutoResponse;
                form.AutoResponseSubject = model.AutoResponseSubject;
                form.AutoResponseBody    = model.AutoResponseBody;

                // Active form
                form.Active = true;

                var response = Update(form);

                return(response.SetMessage(response.Success
                    ? T("Form_Message_UpdateSuccessfully")
                    : T("Form_Message_UpdateFailure")));
            }

            return(new ResponseModel
            {
                Success = false,
                Message = T("Form_Message_ObjectNotFound")
            });
        }
Пример #2
0
        public ActionResult Configure(ConfigurationSetupModel model, SubmitType submit)
        {
            if (ModelState.IsValid)
            {
                var response = _formService.SaveConfiguration(model);

                if (response.Success)
                {
                    switch (submit)
                    {
                    case SubmitType.Save:
                        return(RedirectToAction("EmbeddedScript", new { id = model.Id }));

                    default:
                        return(RedirectToAction("Configure", new { id = model.Id }));
                    }
                }
            }

            return(View("Setup/Configure", model));
        }