public IActionResult Index() { EmployeeBAL bal = new EmployeeBAL(); var data = bal.ReadEmployees(); IList <Employee> emplist = new List <Employee>(); foreach (DataRow row in data.Tables[0].Rows) { Employee employee = new Employee() { Id = int.Parse(row["Id"].ToString()), EmpName = row["EmpName"].ToString(), Salary = decimal.Parse(row["Salary"].ToString()), DeptNo = int.Parse(row["DeptNo"].ToString()), }; emplist.Add(employee); } return(View(emplist)); }