I'm learning ASP.NET MVC and I need to make a gender drop down list it shows (Male , Female) to the user but the selected gender value saved in the SQL Database is (1 for the male , 2 for the Female)
Thank you.
I tried using the enum in the Model
public int? Gender { get; set; }
public enum Gender
{
Male,Female
}
and this code in the view
@Html.DropDownListFor(m => m.Gender,
new SelectList(Enum.GetValues(typeof(schoolproject1.Models.Gender))),
"Select Gender")