Ejemplo n.º 1
0
        public void AddLink()
        {
            _console.Write("Link Type (sponsoredlink, nonsponsoredlink): ");
            var linkType = _console.ReadLine().ToLower();

            _console.Write("Please enter a description of your site. This will appear when your site is searched: ");
            var descriptionText = _console.ReadLine();

            _console.Write("Please enter your site URL: ");
            var uRl = _console.ReadLine();


            if (linkType == "sponsoredlink")
            {
                _console.Write("Please enter the sponsor name: ");
                var sponsorName = _console.ReadLine();

                _console.Write("Please enter the decimal cost per impression (i.e. search hit): ");
                var costPerImpersion = Decimal.Parse(_console.ReadLine());

                SearchEngine.AddItemToLinkList(linkType, descriptionText, uRl, sponsorName, costPerImpersion);
            }
            else if (linkType == "nonsponsoredlink")
            {
                _console.Write("Please enter the date when your site was last crawled: ");
                var dateLastCrawled = DateTime.Parse(_console.ReadLine());

                _console.Write("Please enter the link content type (forum, blog, other): ");
                var linkContentType = _console.ReadLine().ToLower();

                SearchEngine.AddItemToLinkList(linkType, descriptionText, uRl, dateLastCrawled, linkContentType);
            }

            _console.WriteLine($"You've successfully added a {linkType}");
        }