public DeleteRedirectResponse Delete(int id) { if (id == 0) { return new DeleteRedirectResponse() { Success = false, Message = "Invalid ID passed for redirect to delete" } } ; try { RedirectRepository.DeleteRedirect(id); return(new DeleteRedirectResponse() { Success = true }); } catch (Exception e) { return(new DeleteRedirectResponse() { Success = false, Message = "There was an error deleting the redirect : " + e.Message }); } } }
/// <summary> /// Hack to support legacy version checking. This supports the state that exists before /// we implemented migration version entry on database create, which will exist moving forward. /// This only supports legacy installs /// </summary> /// <param name="db">Database</param> /// <param name="migrationService">Migration service</param> /// <returns>True if success</returns> private bool ValidateTableRead(UmbracoDatabase db, IMigrationEntryService migrationService) { try { // run through creating and deleting a redirect. var redirect = RedirectRepository.AddRedirect(true, "old", "new", "notes"); RedirectRepository.DeleteRedirect(redirect.Id); this.AddTargetVersionMigrationEntry(migrationService); return(true); } catch (Exception) { return(false); } }