I\'m trying to create a dropdown list with an enum property in ASP.NET MVC Core using the tag helper in a Razor view:
Here is the model:
public class Per
The below was what worked for me. This is necessary and the way it is because the enum itself is a class declared under the scope of the class which you are using as a model.
below my model (work in progress) for reference
public class Cart
{
public int CartId { get; set; }
public List Orders { get; set; }
[Required]
public string UserId { get; set; }
public DateTime DeliveryDate { get; set; }
public CartStatus Status { get; set; }
public enum CartStatus
{
Open = 1,
Confirmed = 2,
Shipped = 3,
Received = 4
}
}