// GET: UserManagement public ActionResult Index() { var userListViewModel = new UserListViewModel(); var userBal = new UserBusinessLayer(); var userList = userBal.GetUserList(); var userViewModels = new List <UserViewModel>(); foreach (var item in userList) { var userViewModel = new UserViewModel(); userViewModel.FirstName = item.FirstName; userViewModel.LastName = item.LastName; if (string.IsNullOrEmpty(item.LastName)) { userViewModel.Color = "red"; } else { userViewModel.Color = "green"; } userViewModels.Add(userViewModel); } userListViewModel.UserList = userViewModels; return(View(userListViewModel)); }