private void Update(RoutesPart part) { var contentRouteValues = _contentManager.GetItemMetadata(part).DisplayRouteValues; var displayRouteValues = new RouteValueDictionary { { "id", part.Id }, { "area", "IDeliverable.Seo" } }; var aliases = part.AlternateRoutes.Select(x => x.Alias).ToArray(); foreach (var lookup in _aliasService.Lookup(displayRouteValues).Where(path => !aliases.Contains(path))) { _aliasService.Delete(lookup, AliasSource); } var routeIndex = 0; foreach (var route in part.AlternateRoutes.Where(x => x.Action != null)) { var routeValues = route.Action != AlternateRouteAction.Alias ? new RouteValueDictionary { { "id", part.Id }, { "index", routeIndex }, { "action", "Redirect" }, { "controller", "Route" }, { "area", "IDeliverable.Seo" } } : contentRouteValues; _aliasService.Set(route.Alias, routeValues, AliasSource, true); routeIndex++; } }
public void RemoveAliases(RoutesPart part) { var aliases = part.AlternateRoutes.Select(x => x.Alias).ToArray(); foreach (var alias in aliases) { _aliasService.Delete(alias, AliasSource); } }
private void SetupLazyFields(ActivatedContentContext context, RoutesPart part) { part._alternateRoutes.Loader(() => { var list = JsonConvert.DeserializeObject <List <AlternateRoute> >(part.AlternateRoutesData ?? ""); return(list ?? new List <AlternateRoute>()); }); part._alternateRoutes.Setter(x => { var list = x?.ToList() ?? new List <AlternateRoute>(); part.AlternateRoutesData = JsonConvert.SerializeObject(list, Formatting.None); return(list); }); }
private void RemoveAliases(RoutesPart part) { _routesService.RemoveAliases(part); }
private void PublishAliases(RoutesPart part) { _routesService.PublishAliases(part); }
public void PublishAliases(RoutesPart part) { Update(part); }