24 lines
563 B
C#
24 lines
563 B
C#
using System.Linq;
|
|
using System.Web.Mvc;
|
|
|
|
namespace MileageTraker.Web.ViewModels
|
|
{
|
|
public class SelectListViewModel
|
|
{
|
|
public SelectList Available { get; set; }
|
|
public int? Selected { get; set; }
|
|
|
|
public override string ToString()
|
|
{
|
|
if (Selected > 0)
|
|
{
|
|
var selected = Available.FirstOrDefault(i => i.Value == Selected.ToString());
|
|
if (selected != null)
|
|
{
|
|
return selected.Text;
|
|
}
|
|
}
|
|
return string.Empty;
|
|
}
|
|
}
|
|
} |