コード例 #1
0
        public async Task <IEnumerable <Friend> > ClosestFriends(string _id)
        {
            Friend currentFriend = await _friendsRepository.GetById(_id);

            IEnumerable <Friend> friendsList = await _friendsRepository.GetAllExcept(_id);

            foreach (Friend friend in friendsList)
            {
                var calcLog = new CalculationHistoryLog(friend, friend.CalculateDistance(currentFriend.Position), DateTime.Now);
                await _logRepository.SaveCalculationHistory(calcLog);
            }
            return(friendsList.OrderBy(friend => friend.DistanceToCurrentPosition).Take(3));
        }