Friday, 17 June 2016

Switch through Enum mvc

No comments
  public enum Section
    {
        PersonalDetails = 1,
        GoalsAspirations,
        PersonalProfile,
        BusinessExpectations,
        PersonalityAttitude,
        RoleSelection,
        FinancialProfile
    }


//Controller

  Section section = (Section)System.Enum.Parse(typeof(Section), 5);
  switch (section)
            {
                case Section.PersonalityAttitude:
                    break;
                case Section.RoleSelection:
                    break;
                case Section.FinancialProfile:
                    break;
                default:
                    break;
            }

//To get in int
Model.SectionId = (int)section;