Exemplo n.º 1
0
        public ActionResult Save(ContentDto entity)
        {
            var model      = _modelBll.Query(entity.ModelId);
            var saveState  = BusinessHelper.BuildSaveState(Request);
            var dictionary = model.ModelFields.
                             ToDictionary <ModelFieldDto, string, object>
                                 (item =>
                                 item.Code, item => Request.Form[item.Code]);

            _contentBll.HttpPostSave(entity, saveState, dictionary);

            return(RedirectToAction("Index", "Content", new { CategoryKey = entity.CategoryId }));
        }
Exemplo n.º 2
0
        public ActionResult DesignForm()
        {
            var modelKey = Request.QueryString["ModelKey"];
            var key      = Request.QueryString["Key"];

            ViewBag.Key = key;

            var category = _categoryBll.Query(key);

            if (!string.IsNullOrEmpty(category.FormJson))
            {
                var modelInfo = new ModelDto()
                {
                    ModelId     = Convert.ToInt32(modelKey),
                    ModelFields = category.FormJson.ToList <ModelFieldDto>()
                };
                return(View(modelInfo));
            }

            var model = _modelBll.Query(modelKey);

            return(View(model));
        }