แก้ไข รักษาการ ถ้าไม่ได้ใส่ privilage มาจะให้ default = "PARENT" #2431
All checks were successful
Build & Deploy Leave Service / build (push) Successful in 2m7s
All checks were successful
Build & Deploy Leave Service / build (push) Successful in 2m7s
This commit is contained in:
parent
42f3813a7a
commit
ee2d16925a
2 changed files with 36 additions and 1 deletions
30
BMA.EHR.Domain/Shared/PrivilegeConverter.cs
Normal file
30
BMA.EHR.Domain/Shared/PrivilegeConverter.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue