public override object Install(Package package) { base.Install(package); var themePackage = package as ThemePackage; if (themePackage != null) { var newTheme = themePackage.Theme; newTheme.IsActived = false; if (_themeService.Count(m => m.ID == newTheme.ID) == 0) { _themeService.Add(newTheme); } else { var oldTheme = _themeService.Get(newTheme.ID); oldTheme.Description = newTheme.Description; oldTheme.Thumbnail = newTheme.Thumbnail; oldTheme.Title = newTheme.Title; oldTheme.Url = newTheme.Url; oldTheme.UrlDebugger = newTheme.UrlDebugger; _themeService.Update(oldTheme); } } return(package); }
public override object Install(Package package) { base.Install(package); var themePackage = package as ThemePackage; if (themePackage != null) { var newTheme = themePackage.Theme; newTheme.IsActived = false; if (_themeService.Count(m => m.ID == newTheme.ID) == 0) { _themeService.Add(newTheme); } else { var oldTheme = _themeService.Get(newTheme.ID); if (oldTheme.IsActived) { newTheme.IsActived = true; } _themeService.Update(newTheme); } } return(package); }
public override object Install(Package package) { var filePackage = package as FilePackage; if (filePackage != null && filePackage.Files != null) { filePackage.Files.ForEach(file => { file.FilePath = file.FilePath.Replace("~/Themes", ThemePath); }); } base.Install(package); var themePackage = package as ThemePackage; if (themePackage != null) { var newTheme = themePackage.Theme; newTheme.IsActived = false; if (_themeService.Count(m => m.ID == newTheme.ID) == 0) { _themeService.Add(newTheme); } else { var oldTheme = _themeService.Get(newTheme.ID); oldTheme.Description = newTheme.Description; oldTheme.Thumbnail = newTheme.Thumbnail; oldTheme.Title = newTheme.Title; oldTheme.Url = newTheme.Url; oldTheme.UrlDebugger = newTheme.UrlDebugger; _themeService.Update(oldTheme); } } return(package); }