Пример #1
0
        public IEnumerable <FriendDto> GetAllFriends(DateTime?loanDate, int?loanDuration)
        {
            IEnumerable <Friend> friendList;

            if (loanDate.HasValue && loanDuration.HasValue)
            {
                friendList = _borrowRepo.GetAllFriendsThatBorrowedForLongerThanParticularDaysByParticularDate((DateTime)loanDate, (int)loanDuration);
            }
            else if (loanDuration.HasValue)
            {
                friendList = _borrowRepo.GetAllFriendsThatBorrowedForLongerThanParticularDuration((int)loanDuration);
            }
            else if (loanDate.HasValue)
            {
                friendList = _borrowRepo.GetAllFriendsThatHaveAPublicationOnLoanByParticularDate((DateTime)loanDate);
            }
            else
            {
                friendList = _friendRepo.GetAllFriends();
            }
            return(friendList.Select(f => new FriendDto(f)));
        }