Пример #1
0
        public async Task <ActionResult> GetListOfIds([FromHeader] string Authentication, [FromQuery] string status)
        {
            if (SessionManager.GetSessionState(Authentication) != SessionManager.SessionState.Authorized)
            {
                return(Unauthorized());
            }
            SessionInfo sessionInfo = SessionManager.GetSessionInfo(Authentication);

            if (sessionInfo == null)
            {
                return(Unauthorized());
            }

            int statusNum = -1;

            if (!string.IsNullOrEmpty(status))
            {
                int.TryParse(status, out statusNum);
            }

            using (UnitOfWork uow = new UnitOfWork())
            {
                FriendshipsRepository       friendshipsRepository = new FriendshipsRepository(uow);
                IEnumerable <FriendshipDTO> friendships           = await friendshipsRepository.GetFriendships(sessionInfo.UserId, statusNum);

                return(Ok(friendships));
            }
        }