/// <summary> /// /// </summary> /// <param name="proposal"></param> /// <param name="audienceChannel">Si se le pasa un audienceChannel este se usara para setear price and productName, sino se consultara uno a la BD</param> /// <param name=""></param> /// <returns></returns> private ProposalReviewListItemViewModel MapToProposalReviewListItemViewModel(ProposalDocument proposal, AudienceChannelDocument audienceChannel = null) { if (audienceChannel == null) { audienceChannel = _audienceChannelManager.GetAudienceChannelById(proposal.AudienceChannelId); } AdvertiserProfileDocument advertiserProfile = _advertiserProfileManager.FindProfileByProfileId(proposal.AdvertiserProfileId); ApplicationUser user = _identityManager.FindUserByUserId(advertiserProfile.UserId); CountryDocument country = _catalogManager.FindCountryById(advertiserProfile.CountryBusinessInId); DateTime registerProposal = Convert.ToDateTime(proposal.RegisterDate); string messageDaysAgo = DateUtils.GetTextDaysAgo(registerProposal); return(new ProposalReviewListItemViewModel() { TimeAgoReceived = messageDaysAgo, AdvertiserImageSrc = advertiserProfile.IconUrl, AdvertiserName = user.Name, IdProposal = proposal.Id, Location = country != null?country.Name:"", Price = audienceChannel.Price.ToString() + " kind", ProductName = audienceChannel.Name }); }
public PublisherProposalDetailViewModel FindPublisherProposalDetailVMById(string proposalId) { ProposalDocument proposal = FindProposalById(proposalId); AdvertiserProfileDocument advertiser = _advertiserProfileManager.FindProfileByProfileId(proposal.AdvertiserProfileId); AudienceChannelDocument audienceChannel = GetAudienceChannelById(proposal.AudienceChannelId); string audienceUrl = getAudienceUrlSite(audienceChannel.AudienceId); CountryDocument country = _catalogManager.FindCountryById(advertiser.CountryBusinessInId); return(new PublisherProposalDetailViewModel { Accepted = proposal.AcceptedByPublisher, AdvertiserImage = advertiser.IconUrl, AdvertiserLocation = country.Name, AdvertiserName = advertiser.Title, ProposalId = proposal.Id, QuestionsAndAnswers = proposal.Questions, RejectDetail = proposal.RejectDetail, WebSite = audienceUrl, MemberSinceYear = advertiser.RegisterDate, Price = proposal.Price }); }