コード例 #1
0
        protected ActionResult CreateActionResult(int contentItemId, string view, object ajaxData, Func <object> createFullModel)
        {
            if (Request.IsAjaxRequest())
            {
                AjaxMessageViewModel ajaxMessageModel = new AjaxMessageViewModel {
                    Id = contentItemId, IsDone = ModelState.IsValid, Data = ajaxData
                };
                CRMHelper.AddModelStateErrors(this.ModelState, ajaxMessageModel);

                return(this.Json(ajaxMessageModel, JsonRequestBehavior.AllowGet));
            }
            else
            {
                object model = null;

                if (createFullModel != null)
                {
                    model = createFullModel();
                }

                return(this.View(view, model));
            }
        }