コード例 #1
0
    public static SelectList ToSelectList(this occupancyTimeline enumObj)
    {
        var values = from occupancyTimeline e in Enum.GetValues(typeof(occupancyTimeline))
                     select new { Id = e, Name = string.Format("{0} Months", Convert.ToInt32(e)) };

        return(new SelectList(values, "Id", "Name", enumObj));
    }
コード例 #2
0
    public override string EnumToString(occupancyTimeline value)
    {
        switch (value)
        {
        case OccupancyTimelineHelper.TwelveMonths:
            return("12 Month");

        case OccupancyTimelineHelper.FourteenMonths:
            return("14 Month");

        case OccupancyTimelineHelper.SixteenMonths:
            return("16 Month");

        case OccupancyTimelineHelper.EighteenMonths:
            return("18 Month");

        default:
            return(base.EnumToString(value));
        }
    }