Created
July 16, 2018 10:08
-
-
Save jfversluis/7c4edd10e4bbe6763f0c16035bb44cef to your computer and use it in GitHub Desktop.
Snippet to add the slug to my CFP entity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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