Ejemplo n.º 1
0
 public UsersViewModel MapToViewModel(IEnumerable<User> users)
 {
     var userViewModels = new List<UserViewModel>();
     foreach (User user in users)
     {
         var viewModel = Mapper.Map<User, UserViewModel>(user);
         userViewModels.Add(viewModel);
     }
     var usersModel = new UsersViewModel { users = userViewModels };
     return usersModel;
 }
 public void WhenIGoToTheListOfUsers()
 {
     var controller = new UserController();
     var result = (ViewResult)controller.Index();
     usersViewModel = result.ViewData.Model as UsersViewModel;
 }