Ejemplo n.º 1
0
 public void UniqueCustomUrl(BellumGensDbContext context)
 {
     if (string.IsNullOrEmpty(CustomUrl))
     {
         var    parts = TeamName.Split(' ');
         string url   = string.Join("-", parts);
         while (context.Teams.Where(t => t.CustomUrl == url).SingleOrDefault() != null)
         {
             if (url.Length > 58)
             {
                 url = url.Substring(0, 58);
             }
             url += '-' + Util.GenerateHashString(6);
         }
         CustomUrl = url;
     }
 }