Пример #1
0
        public async Task <IActionResult> TerminateSession(int id, int sessionId)
        {
            var user = await _applicationUserService.GetApplicationUserWithSessionsAsync(id);

            if (user != null)
            {
                var activeSession = user.ActiveSessions.SingleOrDefault(x => x.Id == sessionId);

                if (activeSession != null)
                {
                    activeSession.IsTerminated = true;

                    await _applicationUserService.UpdateApplicationUserAsync(user);

                    return(NoContent());
                }
            }

            return(NotFound());
        }