public static IList <SummaryData> CreateCollection(SummaryDataRepository repository) { List <SummaryData> models = new List <SummaryData>(); SummaryData start = SummaryData.Create(repository); SummaryData end = SummaryData.Create(repository); models.Add(start); models.Add(end); return(models); }
public static SummaryData Create(SummaryDataRepository repository) { int conversions = repository.GetConversions(); int sessions = repository.GetSessions(); decimal conversionRate = ((decimal)conversions / (decimal)sessions) * 100; CampaignData data = repository.GetCampaignData(conversions); SummaryData returnValue = new SummaryData() { Sessions = sessions, Conversions = conversions, Spend = repository.GetSpend(), ConversionCosts = repository.GetConversionCosts(), ReferringDomains = repository.GetReferringDomains(), BrandedSearches = repository.GetBrandedSearches(), SocialTrend = repository.GetSocialTrend(), ConversionRate = conversionRate, OnlineSales = repository.GetOnlineSales(), Users = sessions, PPC = data.PPC, PPCTarget = data.PPCTarget, Banners = data.Banners, BannersTarget = data.BannersTarget, Email = data.Email, EmailTarget = data.EmailTarget, ThirdParty = data.ThirdParty, ThirdPartyTarget = data.ThirdPartyTarget, TopPages = repository.GetPageList(), Keywords = repository.GetWordList(), TrafficStats = repository.GetTrafficStats(sessions, conversions) }; return(returnValue); }