Page 1 of 1

Serach List<Object> for value by column name (MVC)

Posted: Sun Oct 25, 2015 3:17 pm
by dzcadii

Code: Select all

    public class ConfigurationVO
    {
        public int id { get; set; }
        public string name { get; set; }
        public string value { get; set; }
    }
//Create an access object that returns a List<object>
//Set your new List<object>

Code: Select all

List<ConfigurationVO> configuration = ConfigurationDAO.GetConfigurationInfo();
//Look for the value by a column name

Code: Select all

ViewData["homePathURL"] = configuration.Find(configItem => configItem.name == "homePathURL").value;