예제 #1
0
        public async Task <IActionResult> GetSessionsByUserId(string id)
        {
            try
            {
                var user = await _usersRepository.FindUser(Guid.Parse(id));

                if (user != null)
                {
                    var sessions = await _sessionsRepository.GetSessionsByUser(user);

                    return(Ok(sessions));
                }

                // This will only happen if the user still hasnt persisted by the time the new client requests for a session
                // The will have no sessions anyways at this point

                return(Ok(id));
            }
            catch (Exception ex)
            {
                return(HandleError(ex));
            }
        }