From 3f4c0720e1e3421431e7baa20882a4a4512a7fab Mon Sep 17 00:00:00 2001 From: ivar Date: Sun, 19 Oct 2025 23:41:23 +0200 Subject: Initial --- src/Utilities/Helpers.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/Utilities/Helpers.cs (limited to 'src/Utilities/Helpers.cs') 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 -- cgit v1.3