internal IFacadeUpdateResult <SetupMenuData> SaveSetupMenu(SetupMenuDto dto) { ArgumentValidator.IsNotNull("dto", dto); FacadeUpdateResult <SetupMenuData> result = new FacadeUpdateResult <SetupMenuData>(); ISetupMenuService service = UnitOfWork.GetService <ISetupMenuService>(); SetupMenu instance = RetrieveOrNew <SetupMenuData, SetupMenu, ISetupMenuService>(result.ValidationResult, dto.Id); if (result.IsSuccessful) { instance.Name = dto.Name; instance.ParentMenuId = dto.ParentMenuId; instance.MenuText = dto.MenuText; instance.Tooltip = dto.Tooltip; instance.NavigateUrl = dto.NavigateUrl; instance.Sort = dto.Sort; instance.MenuTypeId = dto.MenuTypeId; var saveQuery = service.Save(instance); result.AttachResult(instance.RetrieveData <SetupMenuData>()); result.Merge(saveQuery); } return(result); }
internal TDto RetrieveOrNewSetupMenu <TDto>(object instanceId, IDataConverter <SetupMenuData, TDto> converter) where TDto : class { ArgumentValidator.IsNotNull("converter", converter); ISetupMenuService service = UnitOfWork.GetService <ISetupMenuService>(); FacadeUpdateResult <SetupMenuData> result = new FacadeUpdateResult <SetupMenuData>(); SetupMenu instance = RetrieveOrNew <SetupMenuData, SetupMenu, ISetupMenuService>(result.ValidationResult, instanceId); if (result.IsSuccessful) { return(converter.Convert(instance.RetrieveData <SetupMenuData>())); } else { return(null); } }