Exemple #1
0
        public ActionResult EditHtmlContentWidget([ModelBinder(typeof(JSONDataBinder))] SaveWidgetCommandRequest <EditHtmlContentWidgetViewModel> request)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var response = GetCommand <SaveHtmlContentWidgetCommand>().ExecuteCommand(request);
                    if (response != null)
                    {
                        if (request.Content.Id.HasDefaultValue())
                        {
                            Messages.AddSuccess(PagesGlobalization.SaveWidget_CreatedSuccessfully_Message);
                        }

                        return(Json(new WireJson {
                            Success = true, Data = response
                        }));
                    }
                }

                return(Json(new WireJson {
                    Success = false
                }));
            }
            catch (ConfirmationRequestException exc)
            {
                return(Json(new WireJson {
                    Success = false, Data = new { ConfirmationMessage = exc.Resource() }
                }));
            }
        }
        public ActionResult EditServerControlWidget([ModelBinder(typeof(JSONDataBinder))] SaveWidgetCommandRequest <EditServerControlWidgetViewModel> request)
        {
            ValidateModelExplicilty(request.Content);

            if (ModelState.IsValid)
            {
                var viewEngineResult = ViewEngines.Engines.FindView(ControllerContext, request.Content.Url, null);
                if (viewEngineResult == null || viewEngineResult.View == null)
                {
                    Messages.AddError(string.Format(PagesGlobalization.SaveWidget_VirtualPathNotExists_Message, request.Content.Url));
                    return(Json(new WireJson {
                        Success = false
                    }));
                }

                var response = GetCommand <SaveServerControlWidgetCommand>().ExecuteCommand(request);
                if (response != null)
                {
                    if (request.Content.Id.HasDefaultValue())
                    {
                        Messages.AddSuccess(PagesGlobalization.SaveWidget_CreatedSuccessfully_Message);
                    }

                    return(Json(new WireJson {
                        Success = true, Data = response
                    }));
                }
            }

            return(Json(new WireJson {
                Success = false
            }));
        }
Exemple #3
0
        public ActionResult EditServerControlWidget([ModelBinder(typeof(JSONDataBinder))] SaveWidgetCommandRequest <EditServerControlWidgetViewModel> request)
        {
            if (ModelState.IsValid)
            {
                var response = GetCommand <SaveServerControlWidgetCommand>().ExecuteCommand(request);
                if (response != null)
                {
                    if (request.Content.Id.HasDefaultValue())
                    {
                        Messages.AddSuccess(PagesGlobalization.SaveWidget_CreatedSuccessfully_Message);
                    }

                    return(Json(new WireJson {
                        Success = true, Data = response
                    }));
                }
            }

            return(Json(new WireJson {
                Success = false
            }));
        }