示例#1
0
        public UI.ViewDefinition CreateView(UI.ViewDefinition view)
        {
            var dalView = DbEditorService.CreateView(Mapper.Map <DAL.Models.View>(view), CurrentUser.Login);

            if (view.Controls != null)
            {
                foreach (var control in view.Controls)
                {
                    var dalControl = DbEditorService.CreateControl(Mapper.Map <DAL.Models.Control>(control));
                    dalView.Controls.Add(dalControl);
                }
            }

            var newView = Mapper.Map <UI.ViewDefinition>(dalView);

            if (view.ChildViews != null)
            {
                for (var i = 0; i < view.ChildViews.Count; i++)
                {
                    var subView = CreateView(view.ChildViews[i]);
                    newView.ChildViews.Add(subView);
                }
            }

            return(newView);
        }
示例#2
0
        public UI.ControlDefinition CreateControl(UI.ControlDefinition control)
        {
            var dalControl = DbEditorService.CreateControl(Mapper.Map <DAL.Models.Control>(control));

            return(Mapper.Map <UI.ControlDefinition>(dalControl));
        }