public IActionResult Index() { PersonBAL BAL = new PersonBAL(); var details = BAL.ReadPerson(); IList <Person> list = new List <Person>(); foreach (DataRow row in details.Tables[0].Rows) { Person person = new Person() { PersonID = int.Parse(row["PersonId"].ToString()), FirstName = row["FirstName"].ToString(), LastName = row["LastName"].ToString(), Email = row["Email"].ToString(), Mobile = long.Parse(row["Mobile"].ToString()) }; list.Add(person); } return(View(list)); }