add unite discriminator to entry id

This commit is contained in:
Michael 2017-05-23 11:28:30 -04:00
parent 52d46877c9
commit 90a96d093b

View file

@ -201,7 +201,7 @@ public ActionResult SubmitEntry(SubmitContestEntryViewModel model)
entry.ContestId = model.ContestId; entry.ContestId = model.ContestId;
entry.VideoId = model.VideoID; entry.VideoId = model.VideoID;
string allowed = "abcdefghijklmnopqrstuvwxyz1234567890_"; string allowed = "abcdefghijklmnopqrstuvwxyz1234567890_";
entry.Id = entry.Name.ToLower(); entry.Id = entry.Name.ToLower() + "_" + db.ContestEntries.Count().ToString();
foreach (var ch in entry.Id.ToCharArray()) foreach (var ch in entry.Id.ToCharArray())
if (!allowed.Contains(ch)) if (!allowed.Contains(ch))
entry.Id = entry.Id.Replace(ch, '_'); entry.Id = entry.Id.Replace(ch, '_');