public IEnumerable <object> GetUserInquiries(string hostPort, int vkId) { var user = _userService.GetUserByVkId(vkId); if (user == null) { return(null); } var inquiries = _inquiryRepository.GetUserList(user); var userInquiries = new List <UserInquiries>(); foreach (var inquiry in inquiries) { var readyToBay = false; var readyToDownload = false; if (inquiry.Purchase != null) { readyToBay = true; if (inquiry.Purchase.Bought) { readyToDownload = true; } } userInquiries.Add(new UserInquiries() { ApplicationId = inquiry.Id, OfferingUserFirstName = inquiry.Offering.User.FirstName, OfferingUserLastName = inquiry.Offering.User.LastName, ReadyToBay = readyToBay, ReadyToDownload = readyToDownload, OfferingPhoto = Path.Combine("http://", hostPort + @"/" + inquiry.Offering.OfferingPhoto.ImagePath), Price = inquiry.Offering.Price.ToString(CultureInfo.InvariantCulture), Text = inquiry.Text, AvatarPath = inquiry.Offering.User.AvatarPath, Title = inquiry.Offering.Title }); } userInquiries.Reverse(); return(userInquiries); }