public UserDetailDTO CreateUserDetailDTO(User user) { return(new UserDetailDTO() { Id = user.Id, Username = user.Username, EmailAddress = user.EmailAddress, Address = user.Address, AvatarImage = avatarRepo.GetAvatarsForUser(user.Id).Select(a => CreateAvatarIdDTO(a)).FirstOrDefault(), Listings = listingRepo.GetAllListingsForUser(user.Id).Select(l => CreateListingDTO(l)).ToList(), Bids = bidRepo.GetAllBidsForUser(user.Id).Select(b => new BidDTO { Id = b.Id, Dismissed = b.Dismissed, BidAmount = b.BidAmount, User = CreateUserDTO(b.User), Listing = CreateListingDTO(listingRepo.GetListingById(b.ListingId)) }).ToList(), }); }
public IEnumerable <BidDto> GetAllBidsForUser(int userId) { return(_bidRepository.GetAllBidsForUser(userId).ToDto()); }