Skip to content

Instantly share code, notes, and snippets.

Created July 16, 2018 10:08
What would you like to do?
Snippet to add the slug to my CFP entity
var cfpToAddSlug = FriendlyUrlHelper.GetFriendlyTitle(submittedCfp.EventTitle);//SlugHelper.Slugify(submittedCfp.EventTitle);
var i = 0;
// Prevent duplicate slugs
while (_cfpContext.Cfps.Any(cfp => cfp.Slug == cfpToAddSlug))
cfpToAddSlug = $"{cfpToAddSlug}-{++i}";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment