public static string Import(Models.SearchProvider provider, string userId = null) { userId = string.IsNullOrEmpty(userId) ? Account.AuditId : userId; var existing = GetSearchProvider(provider.Name); provider.Id = existing != null ? existing.Id : null; return(Save(provider, userId)); }
public static bool IsDuplicate(Models.SearchProvider provider) { var m = GetSearchProviderById(provider.Name); if (m != null) { return(m.Id != provider.Id); } return(false); }
public static int Register(Models.SearchProvider provider) { var count = 0; if (!Search.Exists(provider)) { Logging.Logger.InfoFormat("Registering search provider: {0}", provider.Name); Search.Save(provider, Account.AuditId); count++; } return(count); }
public static string Save(Models.SearchProvider provider, string userId = null) { userId = string.IsNullOrEmpty(userId) ? Account.AuditId : userId; if (!IsDuplicate(provider)) { var res = Repository.Current.StoreResource("SearchProvider", null, provider, userId); return(res.Id); } else { throw new Exception(string.Format(Localization.GetLocalization(LocalizationType.Exception, "DuplicateResource.Error", "{0} already exists. Duplicates Not Allowed.", "Core"), "Widget Manifest")); } }
public static bool Exists(Models.SearchProvider provider) { var m = GetSearchProvider(provider.Name); return(m != null); }