public class RoutingEventConsumer : IConsumer<GenericRoutingEvent>
{
public Task HandleEventAsync(GenericRoutingEvent eventMessage)
{
var values = eventMessage.RouteValues;
var urlRecord = eventMessage.UrlRecord;
if (urlRecord.EntityName.Equals(nameof(Person), StringComparison.InvariantCultureIgnoreCase))
{
values[NopRoutingDefaults.RouteValue.Controller] = "Person";
values[NopRoutingDefaults.RouteValue.Action] = "PersonDetails";
values[NopRoutingDefaults.RouteValue.SeName] = urlRecord.Slug;
values["area"] = "Admin";
values["id"] = urlRecord.EntityId;
}
/*eventMessage.Handled = true;*/
return Task.CompletedTask;
}
}