using System.Collections.Generic; using System.Linq; using gehGassi.Permissions; namespace gehGassi.Web.Helper { /// /// Hilfsklasse mit diversen Hilfsmethoden /// public static class Tools { /// /// Hilfmethode die, wenn kein Profilbild angegeben ist, den Pfad zu einem Dummy-Bild zurückgibt /// /// Pfad zum Proflbild /// Pfad zum Profilbild oder dummy public static string GetProfileImage(string photo) { if (!string.IsNullOrWhiteSpace(photo)) { if (!photo.ToLowerInvariant().StartsWith("/images/")) return $"/file/documents/{photo}"; else return photo; } return "/images/icon_user.png"; } /// /// Hilfmethode die, wenn kein Profilbild angegeben ist, den Pfad zu einem Dummy-Bild zurückgibt /// /// Pfad zum Proflbild /// Größe des Fotos /// Pfad zum Profilbild oder dummy public static string GetPhotoThumb(string photo, int size) { if (!string.IsNullOrWhiteSpace(photo)) { if (!photo.ToLowerInvariant().StartsWith("/images/")) return $"/file/documents/thumbnails/{size}/{photo}"; else return photo; } return "/images/icon_user.png"; } /// /// Hilfmethode die, wenn kein Hundefoto angegeben ist, den Pfad zu einem Dummy-Bild zurückgibt /// /// Pfad zum Proflbild /// Größe des Fotos /// Pfad zum Profilbild oder dummy public static string GetDogPhotoThumb(string photo, int size) { if (!string.IsNullOrWhiteSpace(photo)) { if (!photo.ToLowerInvariant().StartsWith("/images/")) return $"/file/documents/thumbnails/{size}/{photo}"; else return photo; } return "/images/icon_dog.png"; } /// /// Hilfmethode die, wenn kein Logo angegeben ist, den Pfad zu einem Dummy-Bild zurückgibt /// /// Pfad zum Logo /// Größe des Fotos /// Pfad zum Logo oder dummy public static string GetLogoThumb(string photo, int size) { if (!string.IsNullOrWhiteSpace(photo)) { if (!photo.ToLowerInvariant().StartsWith("/images/")) return $"/file/documents/thumbnails/{size}/{photo}"; else return photo; } return "/images/logo_generic.png"; } public static List PermissionList(params Permission[] permissions) { return permissions.ToList(); } } }