summaryrefslogtreecommitdiffstats
path: root/src/Utilities/Helpers.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Utilities/Helpers.cs')
-rw-r--r--src/Utilities/Helpers.cs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Utilities/Helpers.cs b/src/Utilities/Helpers.cs
new file mode 100644
index 0000000..ba9b648
--- /dev/null
+++ b/src/Utilities/Helpers.cs
@@ -0,0 +1,19 @@
+using System;
+using IOL.Fagprove.Data.Enums;
+
+namespace IOL.Fagprove.Utilities
+{
+ public static class Helpers
+ {
+ public static Guid ToGuid(this string input)
+ {
+ return input.IsGuid() ? new Guid(input) : default;
+ }
+
+ public static UserRole ToUserRole(this string input)
+ {
+ var isEnum = Enum.TryParse(input, out UserRole role);
+ return isEnum ? role : default;
+ }
+ }
+} \ No newline at end of file