summaryrefslogtreecommitdiffstats
path: root/src/Utilities/Helpers.cs
blob: ba9b648e5df9bf41e4789dc0be0e42e206a193c4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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;
        }
    }
}