コード例 #1
0
        public ActionResult RecSongRequest(string songName,string artistName, string url, string comment)
        {
            //store new item, link and new comment(if not null)
            //HtmlScraper scraper = new HtmlScraper();
            //scraper.ScrapeUrl(url);
            //string body = scraper.GetBody();

            //if (body.Contains(songName) && body.Contains(artistName))
            //{
                DataRepository helper = new DataRepository();
                string name = songName + " by " + artistName;
                string username = Session["Username"].ToString();
                int itemId = helper.AddItem(name, username, 1);

                helper.AddLink(url, itemId, username);

                if (comment != "")
                {
                    helper.AddComment(username, itemId, comment);
                }

            return RedirectToAction("Index", new { Id = Session["Username"].ToString(), state = "Network" });
        }
コード例 #2
0
        public ActionResult RecGameRequest(string gameName, string consoleName, string url, string comment)
        {
            //store new item, link and new comment(if not null)
            DataRepository helper = new DataRepository();
            string name = gameName + " on " + consoleName;
            string username = Session["Username"].ToString();
            int itemId = helper.AddItem(name, username, 4);

            helper.AddLink(url, itemId, username);

            if (comment != "")
            {
                helper.AddComment(username, itemId, comment);
            }

            return RedirectToAction("Index", new { Id = Session["Username"].ToString(), state = "Network" });
        }