Skip to content

Instantly share code, notes, and snippets.

@philipusis
Created October 6, 2017 00:37
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 philipusis/ec51e618398e7b34715bcaeb9cfa7b2b to your computer and use it in GitHub Desktop.
Save philipusis/ec51e618398e7b34715bcaeb9cfa7b2b to your computer and use it in GitHub Desktop.
public string GetUserAvatar(int userId)
{
var avatar = Directory.EnumerateFiles(Path.Combine(ftpServerPath, "UserAvatars"))
.Where(x => Path.GetFileNameWithoutExtension(x) == userId.ToString());
if (avatar.Count() != 0)
{
return String.Format("{0}{1}/{2}", downloadPath, "UserAvatars", Path.GetFileName(avatar.First()));
}
else
{
return string.Empty;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment