30 lines
725 B
C#
30 lines
725 B
C#
|
|
using System;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using System.Linq;
|
||
|
|
using System.Threading.Tasks;
|
||
|
|
using Newtonsoft.Json;
|
||
|
|
|
||
|
|
namespace BMA.EHR.Domain.Shared
|
||
|
|
{
|
||
|
|
public class PrivilegeConverter : JsonConverter
|
||
|
|
{
|
||
|
|
public override bool CanConvert(Type objectType)
|
||
|
|
{
|
||
|
|
return objectType == typeof(string);
|
||
|
|
}
|
||
|
|
|
||
|
|
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||
|
|
{
|
||
|
|
if (reader.TokenType == JsonToken.Null)
|
||
|
|
{
|
||
|
|
return "PARENT";
|
||
|
|
}
|
||
|
|
return reader.Value;
|
||
|
|
}
|
||
|
|
|
||
|
|
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||
|
|
{
|
||
|
|
writer.WriteValue(value);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|