Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jfversluis
Created July 16, 2018 10:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfversluis/7c4edd10e4bbe6763f0c16035bb44cef to your computer and use it in GitHub Desktop.
Save jfversluis/7c4edd10e4bbe6763f0c16035bb44cef to your computer and use it in GitHub Desktop.
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