I am new to this. In my model class I have
public class Status
{
public Codes CodeStatus { get; set; }
public enum Codes
{
Unknown = 0,
Green=1,
Yellow=2,
Red =3
}
}
Now when I use this in my controller like this
int dbStatus = 3;
Status oStatus = new Status();
oStatus.CodeStatus = (Status.Codes)dbStatus ;
List<Status> ListStatus = new List<Status>();
ListStatus.Add(oStatus);
return ListStatus.ToList();
When I debug the value of oStatus.CodeStatus
under quick watch it shows "Red"
but when JSON renders in postman, the value comes up in integer rather than "Red". How can Json render it in red, green or yellow values in the list.
JSON looks like this
"FD": [
{
"Id": 416308,
"Name": "Head Office ",
"CodeStatus": 3,
}
]