Skip to content

Commit

Permalink
added catch all for EosAdvokat
Browse files Browse the repository at this point in the history
  • Loading branch information
erlendoksvoll committed Mar 6, 2024
1 parent f9b1c9a commit b267b02
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Altinn.Dan.Plugin.Trad/Models/TitleTypeInternal.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Globalization;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
Expand Down Expand Up @@ -34,11 +35,17 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
if (reader.Value == null || string.IsNullOrEmpty(reader.Value.ToString()) ||
!Enum.TryParse<TitleTypeInternal>(reader.Value.ToString(), true, out _))
{
switch (reader.Value.ToString())
var valueString = reader.Value.ToString();

if (string.IsNullOrEmpty(valueString))
return TitleTypeInternal.Ukjent;

switch (valueString)
{
case "Rettshjelper nr1": return TitleTypeInternal.Rettshjelper;
case "EØS-Advokat": return TitleTypeInternal.EosAdvokat;
case "Utenlandsk advokat": return TitleTypeInternal.UtenlandskAdvokat;
case var _ when valueString.Contains('-'): return TitleTypeInternal.EosAdvokat;
default: return TitleTypeInternal.Ukjent;
}
}
Expand Down

0 comments on commit b267b02

Please sign in to comment.