Exemplo n.º 1
0
        /// <summary>
        /// Создает модель данных для передачи в представление обновления сущности.
        /// </summary>
        /// <param name="formLayoutSettings">Настройки лайаута devexpress.</param>
        /// <param name="dependedModel">Зависимая модель.</param>
        /// <param name="gridModel">Модель грида.</param>
        /// <returns>Модель.</returns>
        object ICrudController.CreateUpdateEditSettingsModel(object formLayoutSettings, object dependedModel,
                                                             object gridModel, object html)
        {
            var model = new GridEditSettingModel <TKey, TGridModel, TEditModel>();

            model.LayoutSettings = (FormLayoutSettings <TGridModel>)formLayoutSettings;
            model.GridSettings   = (TGridModel)gridModel;
            model.Model          = (TEditModel)dependedModel;
            model.Html           = (HtmlHelper <TGridModel>)html;
            return(model);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Создает модель данных для передачи в представление создания сущности.
        /// </summary>
        /// <param name="formLayoutSettings">Настройки лайаута devexpress.</param>
        /// <param name="dependedModel">Зависимая модель.</param>
        /// <param name="gridModel">Модель грида.</param>
        /// <returns>Модель.</returns>
        object ICrudController.CreateNewEditSettingsModel(object formLayoutSettings, object dependedModel,
                                                          object gridModel, object html)
        {
            var model = new GridEditSettingModel <TKey, TGridModel, TCreateModel>();

            model.LayoutSettings = (FormLayoutSettings <TGridModel>)formLayoutSettings;
            model.GridSettings   = (TGridModel)gridModel;
            if (dependedModel == null)
            {
                model.Model = (TCreateModel)((ICrudController)this).CreateNewModel(dependedModel, gridModel);
            }
            else
            {
                model.Model = (TCreateModel)dependedModel;
            }
            model.Html = (HtmlHelper <TGridModel>)html;
            return(model);
        }