mirror of
https://gitlab.com/buildfeed/BuildFeed.git
synced 2024-03-22 21:10:34 +08:00
25 lines
560 B
Plaintext
25 lines
560 B
Plaintext
@using System.ComponentModel.DataAnnotations
|
|
|
|
@model Enum
|
|
|
|
@{
|
|
|
|
Func<object, string> GetDisplayName = o =>
|
|
{
|
|
var result = null as string;
|
|
var display = o.GetType()
|
|
.GetMember(o.ToString()).First()
|
|
.GetCustomAttributes(false)
|
|
.OfType<DisplayAttribute>()
|
|
.LastOrDefault();
|
|
if (display != null)
|
|
{
|
|
result = display.GetName();
|
|
}
|
|
|
|
return result ?? o.ToString();
|
|
};
|
|
}
|
|
|
|
@GetDisplayName(ViewData.Model)
|