public IActionResult Index() { EmployeeBAL employeeBAL = new EmployeeBAL(); var details = employeeBAL.ReadEmployee(); IList <Employee> employees = new List <Employee>(); foreach (DataRow row in details.Tables[0].Rows) { Employee employee = new Employee() { EmpId = int.Parse(row["EmpId"].ToString()), EmpName = row["EmpName"].ToString(), DepId = int.Parse(row["DepId"].ToString()) }; employees.Add(employee); } return(View(employees)); }
public IActionResult Index() { EmployeeBAL employeeBAL = new EmployeeBAL(); var details = employeeBAL.ReadEmployee(); IList <Employee> employees = new List <Employee>(); foreach (DataRow row in details.Tables[0].Rows) { Employee employee = new Employee() { EmployeeID = int.Parse(row["EmployeeID"].ToString()), FirstName = row["FirstName"].ToString(), LastName = row["LastName"].ToString(), Email = row["Email"].ToString(), City = row["City"].ToString(), Mobile = long.Parse(row["Mobile"].ToString()) }; employees.Add(employee); } return(View(employees)); }