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

Information for PHP. Hypertext Preprocessor
Post Reply
dzcadii
Posts: 94
Joined: Sun Mar 01, 2015 4:36 am

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

Post by dzcadii » Sun Oct 25, 2015 3:17 pm

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;

Post Reply