Ejemplo n.º 1
0
        public IActionResult Index()
        {
            var users = UserBL.GetAllUsersSync(_userRepository);

            if (users.Any())
            {
                return(View(new UsersViewModel {
                    Users = users.ToList()
                }));
            }

            List <User> usersFromJson = new GetUsersFromJson("users.json").Execute();

            UserBL.AddManyUsersSync(usersFromJson, _userRepository);
            users = usersFromJson.ToList();

            return(View(new UsersViewModel {
                Users = users.ToList()
            }));
        }