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); }
public UI.ViewDefinition UpdateView(UI.ViewDefinition view) { var dbView = Mapper.Map <DAL.Models.View>(view); dbView = DbEditorService.UpdateView(dbView); return(Mapper.Map <UI.ViewDefinition>(dbView)); }