0

I am trying to return the parameter names from the following enum model. Here is my code

using System.Text.Json.Serialization;


namespace Digital.HrAssist.Services.Models
{
    [JsonConverter(typeof(JsonStringEnumConverter))]
    public enum EExitStatusDescription
    {
        Started,
        Incomplete,
        Completed,
        Cancelled,
        SubmittedForProcessing
    }
}


return o => new EmployeeExitItem
{
      ExitId = o.ExitId,
      EmployeeId = o.EmployeeId,
      KickoffDate = o.KickoffDate,
      Action = (EExitActions)o.ActionId,
      Status = (EExitStatus)o.StatusId,
      StatusDescription = (EExitStatusDescription)o.StatusDescription
};

public class EmployeeExitItem
{
    public Guid ExitId { get; set; }
    public Guid EmployeeId { get; set; }
    public DateTime KickoffDate { get; set; }

    [EnumDataType(typeof(EExitActions))]
    [JsonConverter(typeof(JsonStringEnumConverter))]
    public EExitActions Action { get; set; }

    [EnumDataType(typeof(EExitStatus))]
    [JsonConverter(typeof(JsonStringEnumConverter))]
    public EExitStatus Status { get; set; }

    public EExitStatusDescription StatusDescription { get; set; }
}

So I want to get the parameter names like "Started", "Incomplete" etc however I am currently getting this error "Cannot convert type 'string to 'digital.hrassist.services.models.EExitStatusDescription''"

skydev
  • 1,867
  • 9
  • 37
  • 71

1 Answers1

0

Just :

EExitStatusDescription exit = EExitStatusDescription.Incomplete;

String value = exit.ToString();
Crandel
  • 767
  • 6
  • 10