How to get enum string in an ASP.MVC grid

1

I have the following enum:

public enum RegiaoEnum
{
    CENTRO = 1,
    NORTE = 2,
    SUL = 3,
    SUDESTE = 4,
    CENTROOESTE = 5   
}

And the following View:

@using MeuDominio.Enums;
<div class="animate">
<table ng-table="vm.DadosParams">
    <tr ng-repeat="row in $data" >
        <td class="text-center col-md-3" sortable="'Nome'" data-title="'NOME'">{{row.Nome}}</td>
        <td class="text-center col-md-2" sortable="'Data'" data-title="'DATA'">{{row.Data}}</td>
        <td class="text-center col-md-2" sortable="'Regiao'" data-title="'REGIÃO'">@{{row.Data}}</td>
    </tr>
</table>

What I need is to display the Enum description in the Region (Center, North ...) column instead of the numeric value value.

    
asked by anonymous 08.06.2018 / 15:24

1 answer

-1
@using MeuDominio.Enums;
    @ Enum.GetName (typeof (RegiaoEnum), RegiaoEnum.CENTRO)     
08.06.2018 / 19:38