public IActionResult Login(ClientViewModel clientData) { string firstName = clientData.FirstName; string lastName = clientData.LastName; string password = clientData.Password; List <string> clientGames = new List <string>(); List <int> gamesIdByClientId = new List <int>(); int clientId; if (_clientsRepository.SignIn(firstName, lastName, password)) { ViewBag.UserName = firstName + " " + lastName; clientId = _clientsRepository.GetIdByName(firstName, lastName, password); gamesIdByClientId = _ordersRepository.GetGamesIdByClientId(clientId); foreach (var id in gamesIdByClientId) { clientGames.Add(_gamesRepository.GetGameNameById(id)); } return(View("Logged", clientGames)); } else { return(View("LoginError")); } }